#include <bits/stdc++.h>
using namespace std;
const int MAXN=4e5+5, LOG=25, MAXC=1<<LOG;
int N, H, X, Y, Z;
int A[MAXN];
bitset <MAXC> B;
bitset <MAXC> C;
int main () {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin>>N;
for (int i=0;i<N;i++) {
cin>>A[i];
}
for (int i=0;i<LOG;i++) {
X=1<<i;
Y=X<<1;
for (int j=0;j<X;j++) {
B[j]=0;
C[j]=0;
}
for (int j=0;j<N;j++) {
Z=A[j]&(Y-1);
C[Z]=C[Z]^B[Z];
B[Z]=!B[Z];
}
if (!i) {
H^=B[0]&B[1];
continue;
}
Z=X>>1;
for (int j=Y-1;j>=0;j--) {
if (j&Z) {
if (C[j]) {
H^=X;
}
}
B[j]=B[j]^B[j+1];
}
for (int j=Z;j<Y;j++) {
if (B[j]^B[j+1]) {
if (j&Z) {
if (B[j]^B[X+((j&X)<<1)-j]) {
H^=X;
}
}
if (j&X) {
if (B[0]^B[Y-j]) {
H^=X;
}
}
}
}
}
cout<<H<<'\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
605 ms |
8696 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
638 ms |
8696 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
638 ms |
8696 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
605 ms |
8696 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
605 ms |
8696 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |