# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
720349 | 2023-04-08T04:34:36 Z | GrandTiger1729 | XOR Sum (info1cup17_xorsum) | C++17 | 1600 ms | 12768 KB |
#include <bits/stdc++.h> using namespace std; const int N = 30; int main(){ cin.tie(0)->sync_with_stdio(0); int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; int ans = 0; for (int j = 0; j < N; j++){ long long cnt = 0; for (int i = 0; i < n; i++){ if (a[i] & 1 << j) cnt += n + 1; } ans ^= (cnt & 1) << j; } for (int j = 1; j <= N; j++){ vector<int> b(n); transform(a.begin(), a.end(), b.begin(), [&](int x){ return x % (1 << j); }); sort(b.begin(), b.end()); long long cnt = 0; for (int i = 0; i < n; i++){ cnt += b.end() - lower_bound(b.begin(), b.end(), (1 << j) - b[i]); cnt += b[i] >= (1 << j - 1); } cnt /= 2; ans ^= (cnt & 1) << j; } cout << ans << '\n'; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 340 KB | Output is correct |
2 | Correct | 12 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1658 ms | 12768 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1658 ms | 12768 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 340 KB | Output is correct |
2 | Correct | 12 ms | 340 KB | Output is correct |
3 | Correct | 284 ms | 1988 KB | Output is correct |
4 | Correct | 304 ms | 1996 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 340 KB | Output is correct |
2 | Correct | 12 ms | 340 KB | Output is correct |
3 | Execution timed out | 1658 ms | 12768 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |