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

Bitwise operations 2

Time limit: 1000 ms
Memory limit: 256 MB
Given $q$ queries, each query consists of two non-negative 15-bit integers $a$ and $b$. Print the integer $c$ as the result, where $c$ is calculated as follows: - For bits from 0 to 4, the corresponding bit of $c$ is the XOR of the two corresponding bits in $a$ and $b$. - For bits from 5 to 9, the corresponding bit of $c$ is the AND of the two corresponding bits in $a$ and $b$. - For bits from 10 to 14, the corresponding bit of $c$ is the OR of the two corresponding bits in $a$ and $b$. For example:
### Input - The first line contains an integer $q$. - The next $q$ lines each contain two non-negative integers $a$ and $b$. ### Output - Print $q$ lines, each line containing an integer representing the result. ### Constraints - $1 \le q \le 10^5$. - $0 \le a, b < 2^{15}$. ### Example Input: ``` 5 14770 18964 14658 8827 30303 24969 30474 19570 10695 19875 ``` Output: ``` 30726 14425 29718 31768 28036 ```
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 (0) Solution