#P7502. 「HMOI R1」不知道是啥的垃圾题
「HMOI R1」不知道是啥的垃圾题
Description
You need to maintain a multiset that supports three operations:
- Insert a pair of non-negative integers.
- Delete a pair of non-negative integers. It is guaranteed that this pair is already in the set.
- Given a pair of non-negative integers , ask how many pairs in the set satisfy , where denotes the bitwise XOR operation.
In this problem, all “pairs” refer to ordered pairs.
Input Format
The first line contains a non-negative integer , representing the number of operations.
The next lines each contain one operation in the following format:
1 x ymeans inserting the pair .2 x ymeans deleting the pair . It is guaranteed that appears in the multiset at least once at this moment.3 x ymeans querying the pair .
Output Format
Output lines. For each query, output one line with a non-negative integer, representing the answer to the query.
6
3 1 2
1 3 2
1 4 5
3 6 2
2 3 2
3 6 2
0
1
0
Hint
For the sample, during the first query there are no pairs in the set, so the answer is .
During the second query, the set is . We have , and . Therefore, the only pair that satisfies the condition is , so the answer is .
During the third query, the set is . There is no pair that satisfies the condition, so the answer is .
For all testdata:
- .
- .
This problem uses bundled tests.
| No. | Constraints | Score |
|---|---|---|
| No further constraints |
- Idea: FZzzz
- Solution: FZzzz
- Code: FZzzz
- Data: FZzzz
Translated by ChatGPT 5
京公网安备 11011102002149号