# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
867657 | sleepntsheep | XOR (IZhO12_xor) | C++17 | 0 ms | 344 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 <iostream>
#include <vector>
#include <algorithm>
#include <deque>
#include <set>
#include <utility>
#include <array>
using namespace std;
#define ALL(x) x.begin(), x.end()
#define ShinLena cin.tie(nullptr)->sync_with_stdio(false);
using ll = long long;
#define N 250005
int n, x, a[N], fw[N], c[N<<1], C;
pair<int, int> ans;
inline void upd(int p, int k) { for (; p; p-=p&-p) fw[p] = max(fw[p], k); }
inline int qry(int p) { int z = 0; for (; p<N; p+=p&-p) z = max(z, fw[p]); return z; }
int main()
{
ShinLena;
cin >> n >> x;
c[C++] = x;
for (int i = 1; i <= n; ++i) cin >> a[i], a[i] ^= a[i-1], c[C++] = a[i], c[C++] = a[i] ^ x;
sort(c, c+C); C = unique(c, c+C) - c;
for (int i = n; i >= 1; --i)
{
upd(1+lower_bound(c, c+C, a[i])-c, i);
int w = 1+lower_bound(c, c+C, x ^ a[i-1])-c, j = qry(w);
ans = max(ans, {j-i+1, -i});
}
cout << -ans.second << ' ' << ans.first;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |