atcoder#ABC261E. [ABC261E] Many Operations
[ABC261E] Many Operations
Score : points
Problem Statement
We have a variable and kinds of operations that change the value of . Operation is represented as a pair of integers , and is the following operation:
- if , it replaces the value of with ;
- if , it replaces the value of with ;
- if , it replaces the value of with .
Initialize with the value of and execute the following procedures in order:
- Perform Operation , and then print the resulting value of .
- Next, perform Operation in this order, and then print the value of .
- Next, perform Operation in this order, and then print the value of .
- Next, perform Operation in this order, and then print the value of .
What are ${\rm and}, {\rm or}, {\rm xor}$?
The of non-negative integers and are defined as follows:
- When is written in base two, the digit in the 's place () is if both of the digits in that place of and are , and otherwise.
- When is written in base two, the digit in the 's place () is if at least one of the digits in that place of and is , and otherwise.
- When is written in base two, the digit in the 's place () is if exactly one of the digits in that place of and is , and otherwise.
For example, , , and .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print lines, as specified in the Problem Statement.
3 10
3 3
2 5
1 12
9
15
12
The initial value of is .
- Operation changes to .
- Next, Operation changes to , and then Operation changes it to .
- Next, Operation changes to , and then Operation changes it to , and then Operation changes it to .
9 12
1 1
2 2
3 3
1 4
2 5
3 6
1 7
2 8
3 9
0
2
1
0
5
3
3
11
2