# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
508531 |
2022-01-13T11:46:35 Z |
sidon |
XOR (IZhO12_xor) |
C++17 |
|
2000 ms |
151676 KB |
#include <bits/stdc++.h>
using namespace std;
int N, X, pref, ind, k;
map<int, int> t[30];
void minim(int l, int r) {
if(l && r-l > k) k = r-l, ind = l;
}
int main() {
ios::sync_with_stdio(0), cin.tie(0);
cin >> N >> X;
for(int i = 1; i <= N + 1; i++) {
int u = 0;
for(int j = 30; --j >= 0; ) {
if(X & (1<<j)) {
if(!(pref & (1<<j))) u ^= 1<<j;
if(!j) minim(t[j][u], i);
} else {
if(pref & (1<<j)) minim(t[j][u], i), u ^= 1<<j;
else minim(t[j][u ^ (1<<j)], i);
}
}
minim(t[0][u], i);
int v = 0;
for(int j = 30; --j >= 0; ) {
if(pref & (1<<j)) v |= 1<<j;
t[j][v] = t[j][v] ? : i;
}
cin >> v;
pref ^= v;
}
if(!X) ind = 1, k = N;
cout << ind << ' ' << k;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
460 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
444 KB |
Output is correct |
4 |
Correct |
4 ms |
820 KB |
Output is correct |
5 |
Correct |
56 ms |
3228 KB |
Output is correct |
6 |
Correct |
67 ms |
3992 KB |
Output is correct |
7 |
Correct |
65 ms |
3648 KB |
Output is correct |
8 |
Correct |
79 ms |
3852 KB |
Output is correct |
9 |
Correct |
829 ms |
62692 KB |
Output is correct |
10 |
Correct |
808 ms |
64208 KB |
Output is correct |
11 |
Correct |
769 ms |
58840 KB |
Output is correct |
12 |
Correct |
873 ms |
58640 KB |
Output is correct |
13 |
Correct |
754 ms |
54492 KB |
Output is correct |
14 |
Correct |
805 ms |
57780 KB |
Output is correct |
15 |
Correct |
909 ms |
72836 KB |
Output is correct |
16 |
Correct |
743 ms |
54696 KB |
Output is correct |
17 |
Execution timed out |
2080 ms |
151676 KB |
Time limit exceeded |
18 |
Halted |
0 ms |
0 KB |
- |