#include <bits/stdc++.h>
using namespace std;
const int M=30;
int n,a[1000004],b[1000004];
int c[39],ans;
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;
for(int o=0;o<n;o++){
for(int O=o;O<n;O++){
int bo=b[O]+b[o];
// cout<<bo<<" "<<b1<<" "<<b2<<" "<<B1<<" "<<B2<<endl;
if((bo>=b1&&bo<=b2)||(bo>=B1&&bo<=B2)){
k++;
}
}
}
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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
271 ms |
424 KB |
Output is correct |
2 |
Correct |
272 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1649 ms |
8312 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1649 ms |
8312 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
271 ms |
424 KB |
Output is correct |
2 |
Correct |
272 ms |
376 KB |
Output is correct |
3 |
Execution timed out |
1659 ms |
2088 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
271 ms |
424 KB |
Output is correct |
2 |
Correct |
272 ms |
376 KB |
Output is correct |
3 |
Execution timed out |
1649 ms |
8312 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |