제출 #508464

#제출 시각아이디문제언어결과실행 시간메모리
508464sidonXOR (IZhO12_xor)C++17
0 / 100
1 ms440 KiB
#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); } } 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; }
#Verdict Execution timeMemoryGrader output
Fetching results...