#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
int n;
int a[N];
int main() {
#ifdef wws
freopen ("in.txt", "r", stdin);
#endif
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int ans = 0;
for (int b = 0; b < 30; b++) {
vector<int> v;
int m = (1 << (b + 1));
for (int i = 0; i < n; i++) {
v.push_back(a[i] % m);
// cout << v.back() << ' ';
}
// cout << endl;
int cnt = 0;
for (int i = 0; i < n; i++) {
for (int j = i; j < n; j++) {
if ((v[i] + v[j]) % m >= m / 2) {
++cnt;
}
}
}
// cout << cnt << endl;
if (cnt & 1) {
ans += (1 << b);
}
}
cout << ans;
}
/*
m = 2^ (x+ 1)
bits: [0...b]
0 ... 2^b - 1
m - 1 >= vi + vj >= m / 2
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
491 ms |
336 KB |
Output is correct |
2 |
Correct |
493 ms |
540 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1660 ms |
15048 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1660 ms |
15048 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
491 ms |
336 KB |
Output is correct |
2 |
Correct |
493 ms |
540 KB |
Output is correct |
3 |
Execution timed out |
1638 ms |
4052 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
491 ms |
336 KB |
Output is correct |
2 |
Correct |
493 ms |
540 KB |
Output is correct |
3 |
Execution timed out |
1660 ms |
15048 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |