#arc137d. [arc137_d]Prefix XORs
[arc137_d]Prefix XORs
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 ?
The bitwise of non-negative integers and , , is defined as follows:
- When is written in base two, the digit in the 's place () is if exactly one of and is , and otherwise.
For example, we have (in base two: ).
Generally, the bitwise of integers 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 .
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.
Sample Input 1
3 2
2 1 3
Sample Output 1
0 1
Each operation changes as follows.
- Initially: .
- After the first operation: .
- After the second operation: .
Sample Input 2
10 12
721939838 337089195 171851101 1069204754 348295925 77134863 839878205 89360649 838712948 918594427
Sample Output 2
716176219 480674244 678890528 642764255 259091950 663009497 942498522 584528336 364872846 145822575 392655861 844652404