#include <bits/stdc++.h>
using namespace std;
const int M=29;
int n,a[1000004],b[1000004];
int c[39],ans;
void work(int x,int y,int &k){
int l=-1,r=-1;
int K=0;
for(int o=n-1;o>=0;o--){
// cout<<b[o]<<endl;
while(l+1<n&&b[l+1]+b[o]<x) l++;
while(r+1<n&&b[r+1]+b[o]<=y) r++;
if(o>l&&o<=r) K++;
if(l<=r)
k+=(r-l);
// cout<<l<<" "<<r<<" "<<x<<" "<<y<<" "<<b[o]<<" "<<b[r]<<endl;
}
// k-=K;
// if(k&1) cout<<K<<" IOIOIIII"<<endl;
// k/=2;
// k+=K;
}
int main(){
ios::sync_with_stdio(false);
for(int i=1;i<=M;i++){
c[i]=(1<<(i+1))-1;
}
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
}
for(int i=1;i<=M;i++){
for(int j=0;j<n;j++){
b[j]=c[i]&a[j];
}
sort(b,b+n);
int b1=(1<<(i));
int b2=((1<<(i+1))-1);
int B1=b1+(1<<(i+1));
int B2=((1<<(i+2))-2);
int k=0;
work(b1,b2,k);
work(B1,B2,k);
// cout<<k<<endl;
if(k&1){
ans|=(1<<(i));
}
}
int k=0;
for(int i=0;i<n;i++){
if(a[i]&1) k++;
}
if((k*(n-k))&1){
ans++;
}
cout<<ans<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1613 ms |
8108 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1613 ms |
8108 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |