#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--){
j=min(j,i); k=min(k,i); l=min(l,i);
while(j<i+1 and a[i]+a[j]<v)j++;
while(k<i+1 and a[i]+a[k]<2*v)k++;
while(l<i+1 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 |
Correct |
7 ms |
332 KB |
Output is correct |
2 |
Correct |
7 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1006 ms |
4224 KB |
Output is correct |
2 |
Correct |
904 ms |
8264 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1006 ms |
4224 KB |
Output is correct |
2 |
Correct |
904 ms |
8264 KB |
Output is correct |
3 |
Correct |
1405 ms |
10968 KB |
Output is correct |
4 |
Correct |
1382 ms |
10584 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
332 KB |
Output is correct |
2 |
Correct |
7 ms |
376 KB |
Output is correct |
3 |
Correct |
217 ms |
1644 KB |
Output is correct |
4 |
Correct |
184 ms |
1644 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
332 KB |
Output is correct |
2 |
Correct |
7 ms |
376 KB |
Output is correct |
3 |
Correct |
1006 ms |
4224 KB |
Output is correct |
4 |
Correct |
904 ms |
8264 KB |
Output is correct |
5 |
Correct |
1405 ms |
10968 KB |
Output is correct |
6 |
Correct |
1382 ms |
10584 KB |
Output is correct |
7 |
Correct |
217 ms |
1644 KB |
Output is correct |
8 |
Correct |
184 ms |
1644 KB |
Output is correct |
9 |
Execution timed out |
1629 ms |
13572 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |