#include <bits/stdc++.h>
using namespace std;
int ans;
int main() {
int n; cin>>n;
vector<int> v;
for (int i=0; i<n; ++i) {
int a; cin>>a;
v.push_back(a);
}
for (int b=0; b<29; ++b) {
vector<int> lf, rf;
for (auto u : v) {
if (u&(1<<b)) rf.push_back(u);
else lf.push_back(u);
}
v.clear();
for (auto u : lf) v.push_back(u);
for (auto u : rf) v.push_back(u);
int tmp=0, l=n-1, r=n-1, val=(1<<(b+1))-1, lb=1<<b, ub=(1<<(b+1))-1;
for (int i=0; i<n; ++i) {
while (l >= 0 && (v[i]&val)+(v[l]&val) >= lb) --l;
while (r >= 0 && (v[i]&val)+(v[r]&val) > ub) --r;
(tmp+=max(0, r-l+1))%=2;
}
l=n-1, r=n-1, lb=(1<<(b+1))+(1<<b), ub=(1<<(b+2))-2;
for (int i=0; i<n; ++i) {
while (l >= 0 && (v[i]&val)+(v[l]&val) >= lb) --l;
while (r >= 0 && (v[i]&val)+(v[r&val]) > ub) --r;
(tmp+=max(0, r-l+1))%=2;
}
if (tmp) ans^=1<<b;
}
cout<<ans<<"\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
597 ms |
13080 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
597 ms |
13080 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |