#Q117. 「一本通 4.1 例 3」校门外的树
「一本通 4.1 例 3」校门外的树
Description
Original source: Vijos P1448
There are many trees outside the school gate. The school decides to plant a certain type of tree in a specific interval at a certain time, ensuring that no two intervals have the same type of tree at any given moment. There are two types of operations:
- , read indicating that a tree is planted between and , with each operation planting a different type of tree;
- , read indicating a query about how many types of trees exist between and .
Note: Each position can have trees planted repeatedly.
Input Format
The first line contains , where is the total length of the road and is the number of operations;
The next lines describe the operations.
Output Format
For each operation, output an answer.
Sample 1
5 4
1 1 3
2 2 5
1 2 4
2 3 5
1
2
Data Range and Hints
For of the data, ;
For of the data, ;
For of the data, , ensuring .