#P5604. 小 O 与排列
小 O 与排列
Description
Little O has a permutation of length . His good friend has a sequence of length , with values in .
One day, Little O suddenly wondered whether there exists a pair of indices such that and . He solved this problem easily. However, sometimes modifies the value at some position in this sequence, and also asks the above question for many different pairs . Now Little O does not know how to handle it.
Can you, the smart one, help Little O solve this problem?
Input Format
The first line contains two positive integers , where is the total number of modifications and queries.
The second line contains positive integers , representing the permutation .
The third line contains positive integers , representing the initial sequence .
The next lines each contain three positive integers, in one of the following two formats:
1 i v, meaning set to .2 l r, meaning query whether there exists a pair of indices such that and .
Output Format
For each query, if such a pair exists, output Yes; otherwise output No.
3 4
3 1 2
2 2 1
2 2 3
1 2 3
1 3 3
2 2 3
Yes
No
Hint
Hint
The input size is large, so please use a fast input method.
Explanation of the samples
For the first query, the pair satisfies the requirement.
For the second query, no pair satisfies the requirement.
Constraints
This problem has subtasks. You must pass all test points within a subtask to get the score for that subtask.
For all testdata, , , .
| # | Score | Special Properties | Time Limit | |
|---|---|---|---|---|
| 1 | 7 | |||
| 2 | 23 | |||
| 3 | 15 | No 1 operations |
||
| 4 | In each query, sequence is a permutation | |||
| 5 | 40 |
Blank entries in the table mean there are no special restrictions for that item.
Translated by ChatGPT 5
京公网安备 11011102002149号