#include <bits/stdc++.h>
using namespace std;
int n, a[1888888], tmp[1999999][3];
vector<int> v[31];
int main() {
ios_base::sync_with_stdio(false); cin.tie(0);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
for (int j = 0; j < 30; j++) {
v[j].push_back(a[i]%(1<<(j+1)));
}
}
int ans = 0;
for (int b = 0; b < 30; b++) {
sort(v[b].begin(), v[b].end());
int cnt = 0;
for (int i = 0, j=n, j2=n, j3=n; i < n; i++) {
while (j > 0 and v[b][i] + v[b][j-1] >= (1<<b)) j--;
while (j2 > 0 and v[b][i] + v[b][j2-1] >= (1<<(b+1))) j2--;
while (j3 > 0 and v[b][i] + v[b][j3-1] >= (1<<b)+(1<<(b+1))) j3--;
int a1 = n - j, a2 = n - j2, a3 = n - j3;
cnt += (a1-a2)&1;
cnt += (a3)&1;
}
if (cnt & 1) ans += (1<<b);
}
cout << ans << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |