#SGM0000029. Bình hoa và hoa (Vases and Flowers)
Bình hoa và hoa (Vases and Flowers)
Vases and Flowers
Source: HDU
Version: Phuoc Hung OJ Extended
Problem Statement
Alice has vases numbered through , initially empty. Each vase can contain at most one flower. Process operations:
1 A F: Alice receives flowers and scans vases from to the right. She puts a flower into every empty vase encountered, skips occupied vases, and stops when no flower remains or vase has been processed. Extra flowers are discarded. If at least one flower is placed, print the positions of the first and last vases receiving a flower. If none can be placed, printCan not put any one..2 A B: clean all vases from through and print the number of flowers discarded.
Input
The first line contains .
The next lines each contain three integers describing one operation.
Output
For type 1, print the first and last positions, or Can not put any one..
For type 2, print the number of discarded flowers.
Subtasks
- Subtask 1 — 20%: .
- Subtask 2 — 30%: .
- Subtask 3 — 50%: , , and type
2satisfies .
Examples
Input
10 5
1 3 5
2 4 5
1 1 8
2 3 6
1 8 8
Output
3 7
2
1 9
4
Can not put any one.
Explanation
The sample is processed in order; every printed item/line corresponds to an operation that requires output.