# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
318942 | 2020-11-03T14:06:20 Z | NachoLibre | XOR Sum (info1cup17_xorsum) | C++14 | 1589 ms | 39896 KB |
#include <bits/stdc++.h> using namespace std; const int N = 1000006, M = 29; int n, a[N], x; vector<pair<int, int> > v; void nextsort(int b) { vector<pair<int, int> > nv[2]; for(int i = 0; i < n; ++i) { v[i].first |= (a[v[i].second] & (1 << b)); nv[!!(v[i].first & (1 << b))].push_back(v[i]); } v.clear(); for(int i = 0; i < 2; ++i) { for(int j = 0; j < nv[i].size(); ++j) { v.push_back(nv[i][j]); } } } int xorcount(int b) { int r = n, dr = 0; for(int i = 0; i < n; ++i) { while(r > i && ((v[r - 1].first + v[i].first) & (1 << b))) --r; dr ^= ((n - r) & 1); if(r == i) ++r; } return dr; } int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n; for(int i = 1; i <= n; ++i) { cin >> a[i]; v.push_back({0, i}); if(n & 1 ^ 1) x ^= a[i]; } for(int i = 0; i < M; ++i) { x ^= (xorcount(i) << i); nextsort(i); } cout << x << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 492 KB | Output is correct |
2 | Correct | 4 ms | 492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1548 ms | 34720 KB | Output is correct |
2 | Correct | 1363 ms | 31164 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1548 ms | 34720 KB | Output is correct |
2 | Correct | 1363 ms | 31164 KB | Output is correct |
3 | Correct | 1484 ms | 36424 KB | Output is correct |
4 | Correct | 1382 ms | 35968 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 492 KB | Output is correct |
2 | Correct | 4 ms | 492 KB | Output is correct |
3 | Correct | 91 ms | 4396 KB | Output is correct |
4 | Correct | 89 ms | 4244 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 492 KB | Output is correct |
2 | Correct | 4 ms | 492 KB | Output is correct |
3 | Correct | 1548 ms | 34720 KB | Output is correct |
4 | Correct | 1363 ms | 31164 KB | Output is correct |
5 | Correct | 1484 ms | 36424 KB | Output is correct |
6 | Correct | 1382 ms | 35968 KB | Output is correct |
7 | Correct | 91 ms | 4396 KB | Output is correct |
8 | Correct | 89 ms | 4244 KB | Output is correct |
9 | Correct | 1471 ms | 39896 KB | Output is correct |
10 | Correct | 1518 ms | 39636 KB | Output is correct |
11 | Incorrect | 1589 ms | 39652 KB | Output isn't correct |