AtCoder Regular Contest 137
D
Prefix XORs
AtCoder
⌀ 2191
原题
← CE →
翻译中…

Problem Statement

翻译中…

You are given an integer sequence of length $N$: $A=(A_1,A_2,\cdots,A_N)$, and an integer $M$.

翻译中…

For each $k=1,2,\cdots,M$, find the value of $A_N$ after doing the operation below $k$ times.

翻译中…
  • For every $i$ ($1 \leq i \leq N$), simultaneously, replace the value of $A_i$ with $A_1 \oplus A_2 \oplus \cdots \oplus A_i$.
翻译中…

Here, $\oplus$ denotes bitwise $\mathrm{XOR}$.

翻译中…

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. For example, we have $3 \oplus 5 = 6$ (in base two: $011 \oplus 101 = 110$). 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

翻译中…
  • $1 \leq N \leq 10^6$
  • $1 \leq M \leq 10^6$
  • $0 \leq A_i < 2^{30}$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N M
A_1 A_2 \cdots A_N

翻译中…

Output

翻译中…

Print the answers for respective values of $k$, separated by spaces.

翻译中…

样例

Input #1
3 2
2 1 3
Output #1
0 1
Each operation changes $A$ as follows. - Initially: $A=(2,1,3)$. - After the first operation: $A=(2,3,0)$. - After the second operation: $A=(2,1,1)$.
Input #2
10 12
721939838 337089195 171851101 1069204754 348295925 77134863 839878205 89360649 838712948 918594427
Output #2
716176219 480674244 678890528 642764255 259091950 663009497 942498522 584528336 364872846 145822575 392655861 844652404
题目信息
题号
arc137_d
时间限制
4 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。