Submission #497529

#TimeUsernameProblemLanguageResultExecution timeMemory
497529thekccXOR (IZhO12_xor)C++14
0 / 100
2100 ms1844 KiB
#include <bits/stdc++.h>
using namespace std;

const int N = 500001;

int pre[N],a[N];
int bi,bk,n,x;

int main(){
	cin.tie(0)->sync_with_stdio(0);
	cin >> n;
	cin >> x;
	pre[0]=0;
	for(int i=1; i<=n; i++){
        cin >> a[i];
        pre[i]=pre[i-1]^a[i];
	}
	bi=-1;
	bk=-1;
    for(int i=0; i<n; i++){
        for(int j=i+1; j<=n; j++){
            if(x<=(pre[j]^pre[i])) {
                if(j-i>bk){
                   bi=i; bk=j-i;
                }
            }
        }
	}
	cout << bi+1 << " " << bk<<endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...