Processing math: 100%
Minimum Xor Pair Query - MarisaOJ: Marisa Online Judge

Minimum Xor Pair Query

Time limit: 2000 ms
Memory limit: 256 MB
For a sequence of integers initially empty, perform a series of q queries of the following types: - 1x: Add the integer x to the sequence. - 2x: Remove **one** occurrence of x from the sequence. There is at least one x in the sequence at this point. - 3: Print the minimum XOR value between two distinct integers in the sequence. There are at least two numbers in the sequence at this point. ### Input - The first line contains an integer q. - The next q lines each contain a query in the specified format. ### Output - Print the answer as an integer for each query of type 3. ### Constraints - 1≤q≤3×105. - 0≤x<230. ### Example Input: 91211031332231103 Output: 8190