# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
128631 | 2019-07-11T07:49:13 Z | E869120 | XOR Sum (info1cup17_xorsum) | C++14 | 1600 ms | 20524 KB |
#include <iostream> #include <vector> #include <algorithm> using namespace std; #pragma warning (disable: 4996) int N, A[1 << 20]; int solve(int bit) { vector<int> vec; long long sum = 0; for (int i = 1; i <= N; i++) { vec.push_back(A[i] % (2 << bit)); vec.push_back((A[i] % (2 << bit)) + (2 << bit)); } sort(vec.begin(), vec.end()); for (int i = 1; i <= N; i++) { int F = (3 << bit) - A[i]; F %= (2 << bit); int pos1 = lower_bound(vec.begin(), vec.end(), F) - vec.begin(); int pos2 = lower_bound(vec.begin(), vec.end(), F + (1 << bit)) - vec.begin(); sum += 1LL * (pos2 - pos1); } long long sum2 = 0; for (int i = 1; i <= N; i++) { if ((A[i] + A[i]) % (2 << bit) >= (1 << bit)) sum2++; } return (sum2 + (sum - sum2) / 2LL) % 2LL; } int main() { scanf("%d", &N); for (int i = 1; i <= N; i++) scanf("%d", &A[i]); int ans = 0; for (int i = 0; i <= 29; i++) { int t = solve(i); if (t == 1) ans += (1 << i); } printf("%d\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 27 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1645 ms | 20524 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1645 ms | 20524 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 27 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 27 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |