제출 #225294

#제출 시각아이디문제언어결과실행 시간메모리
225294cgiosyXOR (IZhO12_xor)C++17
0 / 100
5 ms512 KiB
#include <bits/stdc++.h> using namespace std; struct iii { int l, r, k; }; int main() { ios::sync_with_stdio(0);cin.tie(0); int N, M, K=0, m=0, id=1; cin>>N>>M; vector<iii> T((N+1)*31, {0, 0, INT_MAX}); for(int i=0, x=0; i<N;) { for(int p=1, d=31; d--;) { auto&[l,r,k]=T[p]; if(x&1<<d) p=r=r?:++id; else p=l=l?:++id; T[p].k=min(T[p].k, i); } int j=++i, t; cin>>t; t=x^=t; for(int p=1, d=31; d-- && p;) { auto[l,r,k]=T[p]; int a=t&1<<d, b=M&1<<d; if(!b) j=min(j, T[a?l:r].k); p=a^b ? r : l; t^=a^b; } if(m<i-j) m=i-j, K=j+1; } cout<<K<<' '<<m; }

컴파일 시 표준 에러 (stderr) 메시지

xor.cpp: In function 'int main()':
xor.cpp:12:15: warning: unused variable 'k' [-Wunused-variable]
    auto&[l,r,k]=T[p];
               ^
xor.cpp:21:14: warning: unused variable 'k' [-Wunused-variable]
    auto[l,r,k]=T[p];
              ^
#Verdict Execution timeMemoryGrader output
Fetching results...