atcoder#ARC137D. [ARC137D] Prefix XORs
[ARC137D] Prefix XORs
Score : points
Problem Statement
You are given an integer sequence of length : , and an integer .
For each , find the value of after doing the operation below times.
- For every (), simultaneously, replace the value of with .
Here, denotes bitwise .
What is bitwise $\mathrm{XOR}$?
The bitwise $\mathrm{XOR}$ of non-negative integers $A$ and $B$, $A \oplus B$, is defined as follows:
- When $A \oplus B$ is written in base two, the digit in the $2^k$'s place ($k \geq 0$) is $1$ if exactly one of $A$ and $B$ is $1$, and $0$ otherwise.
Generally, the bitwise \mathrm{XOR} of k integers p_1, p_2, p_3, \dots, p_k is defined as (\dots ((p_1 \oplus p_2) \oplus p_3) \oplus \dots \oplus p_k). We can prove that this value does not depend on the order of p_1, p_2, p_3, \dots p_k.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answers for respective values of , separated by spaces.
3 2
2 1 3
0 1
Each operation changes as follows.
- Initially: .
- After the first operation: .
- After the second operation: .
10 12
721939838 337089195 171851101 1069204754 348295925 77134863 839878205 89360649 838712948 918594427
716176219 480674244 678890528 642764255 259091950 663009497 942498522 584528336 364872846 145822575 392655861 844652404