#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define LL long long
#define st first
#define nd second
#define endl '\n'
using namespace std;
const int MAXN=1000005;
int n,a[MAXN],b[MAXN];
LL ans;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin>>n;
for(int i=0;i<n;++i)
cin>>a[i];
for(int i=0;i<29;++i) {
int xo=(1<<(i+1))-1,t1,t2,t3;
LL cnt=0;
for(int j=0;j<n;++j) {
b[j]=xo&a[j];
}
sort(b,b+n);
for(int j=0;j<n;++j) {
t1=lower_bound(b,b+n,(1<<i)-b[j])-b;
t1=n-t1;
t2=lower_bound(b,b+n,(1<<(i+1))-b[j])-b;
t2=n-t2;
t3=lower_bound(b,b+n,(1<<(i+1))+(1<<i)-b[j])-b;
t3=n-t3;
cnt+=(t1-(t2-t3));
}
if(cnt&1) ans+=(1<<i);
}
cout<<ans<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1668 ms |
12940 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1668 ms |
12940 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |