#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
int n; cin >> n;
if (n < 5000) {
int a[n]; for (int i = 0; i < n; cin >> a[i++]);
int ans = 0;
for (int i = 0; i < n; i++) {
for (int j = i; j < n; j++) {
ans ^= a[i] + a[j];
}
}
cout << ans;
return 0;
}
const int K = 5000;
bitset<2*K> el, pairs;
for (int i = 0; i < n; i++) {
int x; cin >> x;
el.flip(x);
pairs ^= el << x;
}
int ans = 0;
for (int i = 0; i < 2*K; i++) {
ans ^= (pairs[i])*i;
}
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
336 KB |
Output is correct |
2 |
Correct |
7 ms |
516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
303 ms |
336 KB |
Output is correct |
2 |
Correct |
259 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
303 ms |
336 KB |
Output is correct |
2 |
Correct |
259 ms |
336 KB |
Output is correct |
3 |
Runtime error |
3 ms |
592 KB |
Execution killed with signal 6 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
336 KB |
Output is correct |
2 |
Correct |
7 ms |
516 KB |
Output is correct |
3 |
Runtime error |
3 ms |
592 KB |
Execution killed with signal 6 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
336 KB |
Output is correct |
2 |
Correct |
7 ms |
516 KB |
Output is correct |
3 |
Correct |
303 ms |
336 KB |
Output is correct |
4 |
Correct |
259 ms |
336 KB |
Output is correct |
5 |
Runtime error |
3 ms |
592 KB |
Execution killed with signal 6 |
6 |
Halted |
0 ms |
0 KB |
- |