#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
const int L = 35;
map<ll, ll> mp[L];
ll calc(int left, int right, int mod) {
if (left > right) return 0;
return 0;
auto it1 = mp[mod].upper_bound(right);
it1--;
auto it2 = mp[mod].lower_bound(left);
it2--;
ll ret = it1->second - it2->second;
return ret;
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<ll> a(n);
for(int i = 0; i < n; i++) {
cin >> a[i];
}
vector<ll> cnt(L, 0);
vector<ll> p(L);
p[0] = 1LL;
for(int i = 1; i < L; i++) {
p[i] = p[i-1] * 2LL;
}
// for(int i = 0; i < n; i++) {
// for(int j = 0; j < L; j++) {
// mp[j][a[i]%p[j]]++;
// }
// }
for(int i = 0; i < L; i++) {
mp[i][-1] = 0;
}
//
//
// for(int i = 0; i < L; i++) {
// ll add = 0;
// for(auto& j : mp[i]) {
// j.second += add;
// add = j.second;
// }
// }
for(int i = 0; i < n; i++) {
int x = a[i];
for(int j = 0; j < L-1; j++) {
if ((x+x) & p[j]) {
cnt[j]++;
}
if (x & p[j]) {
int left = 0;
int right = p[j] - (x % p[j]) - 1;
cnt[j] += calc(left, right, j+1);
left = p[j+1] - (x % p[j]);
right = p[j+1] - 1;
cnt[j] += calc(left, right, j+1);
} else {
int left = p[j] - (x % p[j]);
int right = (p[j+1]-1) - (x % p[j]);
cnt[j] += calc(left, right, j+1);
}
}
}
ll ans = 0;
for(int i = 0; i < L; i++) {
cnt[i] /= 2;
// cout << cnt[i] << " ";
if (cnt[i] % 2) {
ans += p[i];
}
}
// cerr << "\n";
cout << ans << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
229 ms |
8144 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
229 ms |
8144 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |