| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 734570 | keta_tsimakuridze | XOR Sum (info1cup17_xorsum) | C++14 | 965 ms | 21772 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define f first
#define s second
#define pii pair<int,int>
using namespace std;
const int mod = 1e9 + 7; // !
int t;
vector<int> x;
main(){
ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
int n;
cin >> n;
for(int i = 1; i <= n; i++) {
int a;
cin >> a;
x.push_back(a);
}
// vector<int> cn(30);
// for(int i = 0; i < n; i++) {
// for(int j = i; j < n; j++) {
// for(int k = 0; k < 30; k++)
// if((x[i] + x[j]) & (1 << k)) cn[k] += 1;
// }
// }
int ans = 0;
for(int i = 0; i <= 28; i++) {
vector<int> xn;
for(int j = 0; j < x.size(); j++) {
if(x[j] & (1 << i)) continue;
xn.push_back(x[j]);
}
for(int j = 0; j < x.size(); j++) {
if(x[j] & (1 << i)) xn.push_back(x[j]);
}
x = xn;
vector<int> v = {(1 << i) + (1 << (i + 1)), 1 << (i + 1), 1 << (i)};
vector<int> r(3);
r[0] = r[1] = r[2] = n;
int c = 0, M = (1ll << (i + 1)) - 1;
for(int j = 0; j < x.size(); j++) {
// cout << x[j] << " ";
for(int t = 0; t < 3; t++) {
while(r[t] > 0 && (x[r[t] - 1] & M) + (x[j] & M) >= v[t]) --r[t];
}
c += n - max(j, r[0]) + max(j, r[1]) - max(j, r[2]); // cout << c << endl;
}
// cout << i << " _ " << c << " " << cn[i] << endl;
if(c % 2) ans += 1 << i;
}
cout << ans;
}
컴파일 시 표준 에러 (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... | ||||
