#P6812. 「MCOI-02」Ancestor 先辈
「MCOI-02」Ancestor 先辈
Description
For two sequences , if the following holds:
then we say that is "worse" than ( is the length of , and is the length of ).
If for a sequence , it is "worse" than all of its suffixes, then we call this sequence an ancestor.
Given a sequence of length , there are operations, of the following two types:
1 l r xAdd to the interval .2 l rQuery whether the interval is an ancestor.
Input Format
The first line contains two integers , representing the sequence length and the number of operations.
The second line contains integers , representing the value of each element.
The next lines each start with three integers :
- If , then an integer follows, representing operation .
- If , it represents operation .
Due to a data failure, may be . In such cases, please set by yourself. Thank you.
Output Format
For each operation , output the query result.
7 5
1 9 1 9 8 1 0
2 1 3
1 3 4 9
2 1 4
1 5 6 11
2 2 6
No
Yes
No
Hint
Sample Explanation
For Sample :
- Query whether interval is an ancestor. It is not, output
No. - Add to interval . Now the sequence is .
- Query whether interval is an ancestor. It is, output
Yes. - Add to interval . Now the sequence is .
- Query whether interval is an ancestor. It is not, output
No.
Constraints and Conventions
This problem uses bundled testdata.
- Subtask 1 (1 pts) : The interval length of every query operation is .
- Subtask 2 (9 pts) : .
- Subtask 3 (10 pts): .
- Subtask 4 (10 pts): Only query operations.
- Subtask 5 (10 pts): The number of update operations does not exceed .
- Subtask 6 (20 pts): .
- Subtask 7 (40 pts): No special restrictions.
For of the testdata, , .
This problem enforces optimization.
Notes
Minecraft OI Round 2 C
- Maker: happydef
- Tester: tarjin
Translated by ChatGPT 5
京公网安备 11011102002149号