# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
589088 | proma | XOR (IZhO12_xor) | C++17 | 1 ms | 212 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;
const int N = 250005;
int n, x, a[N], pref[N];
int main() {
/*
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
*/
cin >> n >> x;
pref[0] = 0;
for (int i = 1; i <= n; i ++) {
cin >> a[i];
pref[i] = (pref[i-1] ^ a[i]);
}
int l = 1, r = n, i, k = -1;
while (l <= r) {
int m = (l + r) / 2;
int flag = 0;
for (int j = 1; j + m - 1 <= n; j ++) {
if ((pref[j+m-1] ^ pref[j-1]) >= x) {
i = j;
k = m;
flag = 1;
l = m + 1;
break;
}
}
if (!flag) r = m - 1;
}
cout << i << " " << k;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |