# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
636788 | 2022-08-30T08:24:32 Z | tvladm2009 | XOR Sum (info1cup17_xorsum) | C++14 | 1600 ms | 20500 KB |
#include <iostream> #include <algorithm> #define int long long using namespace std; const int MAX_N = 1e6; int a[MAX_N + 1], v[MAX_N + 1]; int n, answer = 0; int cb(int value) { int l = 1, r = n, sol = n + 1; while (l < r) { int mid = (l + r) / 2; if (v[mid] < value) { sol = mid; l = mid + 1; } else { r = mid - 1; } } return sol; } void solve(int bit) { for (int i = 1; i <= n; i++) { v[i] = a[i] % (1LL << (bit + 1)); } sort(v + 1, v + n + 1); for (int i = 1; i <= n; i++) { int p1 = cb(1LL << bit); int p2 = cb(1LL << (bit + 1)); int p3 = cb(1LL << (bit + 2)); int p4 = cb(1LL << (bit + 3)); if ((p2 - p1 + n + 1 - p3) & 1) { answer += (1LL << bit); } } } signed main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; } for (int b = 0; b < 30; b++) { solve(b); } cout << answer; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 10 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1687 ms | 20500 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1687 ms | 20500 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 10 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 10 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |