-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCF_1516B.cpp
47 lines (43 loc) · 949 Bytes
/
CF_1516B.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <functional>
#include <cstdlib>
#include <list>
#include <iomanip>
#define ll long long
#define MOD 1000000007
#define MAX 1000005
using namespace std;
int main() {
int T;
cin >> T;
for (int t = 0; t < T; t++) {
int N;
cin >> N;
map<int,int> mp;
deque<int> A(N+1);
vector<int> prefixXor(N+1);
int numCnt = 0;
for (int i = 1; i <= N; i++) {
cin >> A[i];
prefixXor[i] = prefixXor[i - 1] ^ A[i];
}
bool isPossible = !prefixXor[N];
for (int i = 1; i <= N; i++)
{
for (int j = i + 1; j < N; j++) {
isPossible |= (prefixXor[i] == (prefixXor[j] ^ prefixXor[i])
&& prefixXor[i] == (prefixXor[N] ^ prefixXor[j]));
}
}
if (isPossible) cout << "YES" << endl;
else cout << "NO" << endl;
}
}