#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
return (ull)rng() % B;
}
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n; cin >> n;
vector<int> a(n);
for(int i=0;i<n;i++){
cin >> a[i];
}
int res=0;
for(int v=(1<<28);v;v>>=1){
for(int i=0;i<n;i++){
a[i]&=(v*2-1);
}
sort(a.begin(), a.end());
int t=0;
for(int i=n-1,j=0,k=0,l=0;i>=0;i--){
while(j<n and a[i]+a[j]<v)j++;
while(k<n and a[i]+a[k]<2*v)k++;
while(l<n and a[i]+a[l]<3*v)l++;
t+=(k-j)+(n-l);
t&=1;
}
if(t)res^=v;
}
cout << res << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
745 ms |
8848 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
745 ms |
8848 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |