//#pragma GCC optimize("O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
//#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const int M = 20;
const int N = 3e6;
int a[N];
int f[N];
void add(int pos) {
for (; pos < N; pos |= pos + 1) {
f[pos]++;
}
}
int get(int pos) {
int res = 0;
for (; pos >= 0; pos = (pos & (pos + 1)) - 1) {
res += f[pos];
}
return res;
}
int get(int l, int r) {
if (l > r) {
return 0;
}
return get(r) - get(l - 1);
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int ans = 0;
int pw = 2;
for (int b = 0; b < M; b++) {
fill(f, f + N, 0);
int kek = 0;
for (int i = 0; i < n; i++) {
int t = a[i] & (pw - 1);
add(t);
if (a[i] & (1 << b)) {
kek += get(0, pw - 1 - t)
+ get(pw - t + pw / 2, pw - 1);
kek &= 1;
} else {
kek += get(pw / 2 - t, pw - 1 - t);
kek &= 1;
}
}
if (kek) {
ans += pw >> 1;
}
pw <<= 1;
}
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
54 ms |
12140 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1701 ms |
15992 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1701 ms |
15992 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
54 ms |
12140 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
54 ms |
12140 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |