atcoder#ABC171E. [ABC171E] Red Scarf
[ABC171E] Red Scarf
Score : points
Problem Statement
There are Snuke Cats numbered , where is even.
Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written.
Recently, they learned the operation called xor (exclusive OR).
What is xor?
For non-negative integers , their xor, $x_1 \sim \textrm{xor} \sim x_2 \sim \textrm{xor} \sim \ldots \sim \textrm{xor} \sim x_n$ is defined as follows:
- When $x_1 \sim \textrm{xor} \sim x_2 \sim \textrm{xor} \sim \ldots \sim \textrm{xor} \sim x_n$ is written in base two, the digit in the 's place () is if the number of integers among whose binary representations have in the 's place is odd, and if that count is even.
For example, .
We know that the xor calculated by Snuke Cat , that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat is . Using this information, restore the integer written on the scarf of each Snuke Cat.
Constraints
- All values in input are integers.
- is even.
- There exists a combination of integers on the scarfs that is consistent with the given information.
Input
Input is given from Standard Input in the following format:
Output
Print a line containing integers separated with space.
The -th of the integers from the left should represent the integer written on the scarf of Snuke Cat .
If there are multiple possible solutions, you may print any of them.
4
20 11 9 24
26 5 7 22
- $5 \sim \textrm{xor} \sim 7 \sim \textrm{xor} \sim 22 = 20$
- $26 \sim \textrm{xor} \sim 7 \sim \textrm{xor} \sim 22 = 11$
- $26 \sim \textrm{xor} \sim 5 \sim \textrm{xor} \sim 22 = 9$
- $26 \sim \textrm{xor} \sim 5 \sim \textrm{xor} \sim 7 = 24$
Thus, this output is consistent with the given information.