题目描述
Chef has an array A of length N. He can perform the following operation on A:
1) Select an index i (1 ≤ i ≤ N - 1) and select an integer X (1 ≤ X < 2^{20}). \
2) Set A_{i} :$= (A_{i} \oplus X)$ and A_{i + 1} :$= (A_{i + 1} \oplus X). (Here, \oplus$ denotes the [bitwise XOR operation]
Determine if Chef can make all the elements of A equal by applying the above operation any number of times (possibly zero).
------ Input Format ------
- The first line contains a single integer T — the number of test cases. Then the test cases follow.
- The first line of each test case contains an integer N — the size of the array A.
- The second line of each test case contains $N space-separated integers A_{1}, A_{2}, \dots, A_{N}$ denoting the array A.
------ Output Format ------
For each test case, output YES if it is possible to make all the elements of A equal by applying the given operation any number of times. Otherwise, output NO.
You may print each character of YES and NO in uppercase or lowercase (for example, yes, yEs, Yes will be considered identical).
------ Constraints ------
$1 ≤ T ≤ 10^{5}$
$1 ≤ N ≤ 10^{5}$
$0 ≤A_{i} < 2^{20}$
- The sum of $N$ over all test cases won't exceed $2 \cdot 10^{5}$.
----- Sample Input 1 ------
3
4
3 2 2 3
6
0 1 2 3 4 5
3
1 2 4
----- Sample Output 1 ------
YES
NO
YES
----- explanation 1 ------
Test Case 1: We can apply the following operation:
- $[3, 2, 2, 3] \xrightarrow{i = 2, X = 1} [3, 3, 3, 3]$
Test Case 2: It can be proved that we can not make all the elements of $A$ equal by applying the given operation.
Test Case 3: We can apply the following operations:
- $[1, 2, 4] \xrightarrow{i = 1, X = 6} [7, 4, 4] \xrightarrow{i = 2, X = 3} [7, 7, 7]$
输入格式
见题面
输出格式
见题面