report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
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: - `1 x`: Add the integer $x$ to the sequence. - `2 x`: 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 \le q \le 3 \times 10^5$. - $0 \le x < 2 ^ {30}$. ### Example Input: ``` 9 1 2 1 10 3 1 3 3 2 2 3 1 10 3 ``` Output: ``` 8 1 9 0 ```
Bitwise operations
Trick-OR-Treat
Bitwise operations 1
Bitwise operations 2
Bitwise operations 3
XOR pair
Full
Range XOR
Cyclic shift
XOR
XORray
Minimum Xor Pair Query
Topic
Data structure
Bitmasks
Rating 1900
Source Atcoder
Solution (1) Solution