# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
589084 | proma | XOR (IZhO12_xor) | C++17 | 0 ms | 328 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>
#define int long long
#define see(x) cout<<#x<<"="<<x<<"\n";
#define endl "\n"
using namespace std;
const int N = 250005;
int n, x, a[N], pref[N];
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
/*
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;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |