#P6617. 查找 Search
查找 Search
Background
Perhaps the best ending between classmates is just being friends.
is a lovely girl.
In the community where she lives, there are trash bins lined up in a row. From left to right, the -th trash bin contains a piece of trash with label .
does not like disorder, so she wants to put all trash whose labels sum to together.
However, the naughty may swap the trash in some bin into another kind.
Angry, wants to test whether can answer: in an interval , does there exist trash in two bins whose labels sum to ?
But cannot solve this problem either, so he turns to the smart you.
Problem Description
Given trash bins, you need to maintain a data structure that supports the following operations:
-
1 pos valmeans changing the label in the -th trash bin to . -
2 l rasks whether there exist two trash bins in whose labels sum to .
Here, denotes the XOR operation, and is the number of answers equal to Yes before this query.
For each operation of type 2, output Yes if such a pair exists; otherwise output No.
Note that for all queries, is the same number.
Input Format
The first line contains three integers , representing the length of the sequence, the number of subsequent operations, and .
The second line contains integers , describing the label in each trash bin.
The next lines each contain three integers in the format opt x y.
Output Format
Let the number of type 2 operations be . Output lines in total.
The -th line is the result of the -th type 2 operation, i.e., Yes or No.
6 4 6
1 3 2 5 5 6
2 1 4
1 4 1
2 0 5
2 3 7
Yes
No
Yes
10 20 10
9 3 6 3 3 3 3 1 4 9
1 3 9
1 6 9
2 3 10
1 3 9
2 4 4
1 1 7
1 1 3
1 5 6
1 3 9
2 4 7
1 2 7
2 6 8
1 6 10
2 2 9
1 7 9
2 3 1
1 3 5
1 5 6
1 9 10
1 3 6
Yes
No
No
No
Yes
Yes
Hint
This problem uses bundled tests, with O2 optimization enabled.
Guaranteed , time limit .
Guaranteed , , time limit .
Guaranteed , time limit .
No special restrictions, time limit .
For all testdata, , .
The testdata guarantees that for each operation, , , and .
Since the input and output are large, faster I/O methods are recommended.
Explanation for Sample Input #1
In the first operation, we query whether there are two numbers in the interval that sum to . Obviously, , so output Yes.
In the second operation, modify to , so the sequence becomes .
In the third operation, query whether there are two numbers in the interval that sum to . There are none, so output No.
In the fourth operation, query whether there are two numbers in the interval that sum to . Obviously, , so output Yes.
Translated by ChatGPT 5