# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
636788 | tvladm2009 | XOR Sum (info1cup17_xorsum) | C++14 | 1687 ms | 20500 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |