luogu#P11160. 【MX-X6-T6】機械生命体
【MX-X6-T6】機械生命体
Background
Original link: https://oier.team/problems/X6G。
Please forgive me, already Understand it The true form of this place Even I cannot Love myself Give me the price for having feelings I am going crazy
Can binary operations and memory bring back human emotions in a mechanical lifeform?
Problem Description
Maintain a multiset , initially empty. It supports the following operations:
1 x: Insert a number into .2 x: Delete a number from . It is guaranteed that at this time contains at least one . If there are multiple , delete only one.3 x k v: For all in that satisfy , increase by and take modulo .4 x: Query $\max\limits_{y\in S} \operatorname{lowbit}(x\oplus y)$. It is guaranteed that at this time is not empty.
Here, denotes the largest integer such that is an integer power of and divides . denotes bitwise XOR。
In particular, in this problem we define .
Input Format
The first line contains an integer , the number of queries.
Then follow lines. Each line first contains an integer indicating the operation type. If , then three integers follow in order; otherwise, one integer follows.
Output Format
For each operation 4, output one integer representing the answer.
11
1 1
1 2
1 2
1 3
1 4
4 10
3 2 1 2
2 4
4 16
2 4
4 16
8
4
2
Hint
Sample Explanation.
At the 6th operation, the multiset is . When querying , $\operatorname{lowbit}(10\oplus 2)=\operatorname{lowbit}(8)=8$ is the maximum.
After the 7th operation, all numbers with are increased by . The numbers in the multiset that satisfy the condition are , so the multiset becomes .
At the 8th operation, one is deleted, and the multiset becomes .
At the 9th operation, query . $\operatorname{lowbit}(16\oplus 4)=\operatorname{lowbit}(20)=4$ is the maximum.
At the 10th operation, one is deleted again, and the multiset becomes .
At the 11th operation, query . $\operatorname{lowbit}(16\oplus 6)=\operatorname{lowbit}(22)=2$ is the maximum.
Constraints.
For all testdata, , , .
Bundled tests, a total of 5 subtasks, with the specific limits as follows:
- Subtask 1 (7 pts): .
- Subtask 2 (16 pts): There is no operation
3. - Subtask 3 (21 pts): For operation
3, . - Subtask 4 (28 pts): For operation
3, . - Subtask 5 (28 pts): No special constraints.
Translated by ChatGPT 5