# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
23662 | TAMREF | XOR (IZhO12_xor) | C++11 | 0 ms | 2996 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int N,x,a[250000];
int seg(int x){
if(!x) return 1;
int X=0;
for(int i=0;i<x;i++) X^=a[i];
for(int i=x;i<N;i++){
if(X>=::x) return i;
X^=(a[i]^a[i-x]);
}
return -1;
}
int main(){
cin>>N>>x;
for(int i=0;i<N;i++) scanf("%d",&a[i]);
int lo=0,hi=N,mid,ans;
for(int tmp;lo<=hi;){
mid=(lo+hi)>>1;
if((tmp=seg(mid))>0){
lo=mid+1;
ans=tmp;
}else hi=mid-1;
}
printf("%d %d\n",ans,mid);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |