제출 #508590

#제출 시각아이디문제언어결과실행 시간메모리
508590sidonXOR (IZhO12_xor)C++17
100 / 100
326 ms42512 KiB
#include <bits/stdc++.h> using namespace std; int N, X, pref, ind, k, curr, u, j; int C[2][1<<22], t[1<<22]; #define minim(l, r) if(l && r-l > k) k = r-l, ind = l void go(bool c) { u = C[c][u] ? : C[c][u] = ++curr; } int main() { cin >> N >> X; for(int i = 1; i <= N + 1; i++) { for(u = 0, j = 1<<30; j/=2; ) { if(!(X & j)) minim(t[C[!(pref & j)][u]], i); go((pref & j) ^ (X & j)); } minim(t[u], i); for(u = 0, j = 1<<30; j/=2; ) { go(pref & j); t[u] = t[u] ? : i; } cin >> u; pref ^= u; } cout << ind << ' ' << k; }
#Verdict Execution timeMemoryGrader output
Fetching results...