Responsive image

问题 1865 --Just do it

1865: Just do it

时间限制: 5 Sec  内存限制: 128 MB
提交: 25  解决: 18
[提交][状态][讨论版][命题人:]

题目描述

There is a nonnegative integer sequence a1...n of length n. HazelFan wants to do a type of transformation called prefix-XOR, which means a1...n changes into b1...n, where bi equals to the XOR value of a1,...,ai. He will repeat it for m times, please tell him the final sequence.
 

输入描述

The first line contains a positive integer T(1≤T≤5), denoting the number of test cases.
For each test case:
The first line contains two positive integers n,m(1≤n≤2×10^5,1≤m≤10^9).
The second line contains n nonnegative integers a1...n(0≤ai≤2^30−1).
 

输出描述

For each test case:
A single line contains n nonnegative integers, denoting the final sequence.
 

样例输入

2
1 1
1
3 3
1 2 3

样例输出

1
1 3 1

来源

 

[提交][状态]
ACM算法攻关部