Submission #867655

#TimeUsernameProblemLanguageResultExecution timeMemory
867655sleepntsheepXOR (IZhO12_xor)C++17
0 / 100
0 ms344 KiB
#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 200005

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)
    {
        int w = 1+lower_bound(c, c+C, x ^ a[i-1]) - c, j = qry(w);
        ans = max(ans, {j-i+1, -i});
        upd(w, i);
    }
    cout << -ans.second << ' ' << ans.first;

    return 0;
}


#Verdict Execution timeMemoryGrader output
Fetching results...