report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Bitwise operations 1 - FlandreOJ: Flandre Online Judge

Bitwise operations 1

Time limit: 1000 ms
Memory limit: 256 MB
Given a non-negative 32-bit integer, initially all bits of this number are '0'. There are three types of queries: - `1 k`: Set the $k$-th bit (i.e., assign the $k$-th bit to '1'). - `2 k`: Reset the $k$-th bit (i.e., assign the $k$-th bit to '0'). - `3 k`: Flip the $k$-th bit (i.e., change '0' to '1' and vice versa). Determine the integer after each query. ### Input - The first line contains an integer $q$. - The next $q$ lines each contain a query in the specified format. ### Output - After each query, print the resulting integer. ### Constraints - $1 \le q \le 10^5$. - $0 \le k \le 31$. ### Example Input: ``` 5 1 0 1 1 2 0 3 1 3 3 ``` Output: ``` 1 3 2 0 8 ```
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
Bitmasks
Rating 1000
Solution (2) Solution