Array Modification

All submissions for this problem are available.
### Read problem statements in [Hindi](http://www.codechef.com/download/translated/OCT19/hindi/MARM.pdf), [Bengali](http://www.codechef.com/download/translated/OCT19/bengali/MARM.pdf), [Mandarin Chinese](http://www.codechef.com/download/translated/OCT19/mandarin/MARM.pdf), [Russian](http://www.codechef.com/download/translated/OCT19/russian/MARM.pdf), and [Vietnamese](http://www.codechef.com/download/translated/OCT19/vietnamese/MARM.pdf) as well. Chef is really interested in the XOR operation. He wants to take a sequence $A_0, A_1, \ldots, A_{N1}$ and for each $i$ from $0$ to $K1$ inclusive (in this order, one by one), perform the following operation:  Let's denote $a = A_{i\%N}$ and $b = A_{N(i\%N)1}$ before this operation.  Change $A_{i\%N}$ to $a \oplus b$, i.e. $a$ XOR $b$. Since Chef is busy, he asked you to find the final sequence he should get after performing these operations. ### Input  The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.  The first line of each test case contains two spaceseparated integers $N$ and $K$.  The second line contains $N$ spaceseparated integers $A_0, A_1, \ldots, A_{N1}$. ### Output For each test case, print a single line containing $N$ spaceseparated integers ― the elements of the final sequence. ### Constraints  $1 \le T \le 70$  $1 \le N \le 10^4$  $1 \le K \le 10^{12}$  $1 \le A_i \le 10^7$ for each valid $i$ ### Subtasks **Subtask #1 (30 points):** $1 \le K \le 10^6$ **Subtask #2 (70 points):** original constraints ### Example Input ``` 1 2 2 1 2 ``` ### Example Output ``` 3 1 ```Author:  mayank1601 
Editorial  https://discuss.codechef.com/problems/MARM 
Tags  array, mayank1601, oct19, r_64, simple 
Date Added:  1092019 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 