| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 994371 | LOLOLO | XOR (IZhO12_xor) | C++17 | 76 ms | 45768 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;
typedef long long ll;
 
#define           f     first
#define           s     second
#define           pb    push_back
#define           ep    emplace
#define           eb    emplace_back
#define           lb    lower_bound
#define           ub    upper_bound
#define       all(x)    x.begin(), x.end()
#define      rall(x)    x.rbegin(), x.rend()
#define   uniquev(v)    sort(all(v)), (v).resize(unique(all(v)) - (v).begin())
#define     mem(f,x)    memset(f , x , sizeof(f))
#define        sz(x)    (ll)(x).size()
#define  __lcm(a, b)    (1ll * ((a) / __gcd((a), (b))) * (b))
#define          mxx    *max_element
#define          mnn    *min_element
#define    cntbit(x)    __builtin_popcountll(x)
#define       len(x)    (int)(x.length())
const int N = 250000 + 100;
int cc = 1;
int nxt[N * 30][2], val[N * 30];
void add(int root, int x, int p) {
    for (int j = 29; j >= 0; j--) {
        int t = bool(x & (1 << j));
        if (nxt[root][t] == 0)
            nxt[root][t] = cc++;
        root = nxt[root][t];
        val[root] = min(val[root], p);
    }
}
int get(int root, int lim, int cur) {
    int ans = 1e9;
    for (int j = 29; j >= 0; j--) {
        int t = bool(cur & (1 << j)) ^ bool(lim & (1 << j));
        if ((lim & (1 << j)) == 0) {
            ans = min(ans, val[nxt[root][1 - t]]);
        }
        if (nxt[root][t] == 0) {
            return ans;
        }
        root = nxt[root][t];
    } 
    ans = min(ans, val[root]);
    return ans;
}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    mem(val, 0x3f);
    int n, lim;
    cin >> n >> lim;
    add(0, 0, 0);
    int ans = 0, l = 0, cur = 0;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        cur ^= x;
        add(0, cur, i);
        int st = get(0, lim, cur);
        if (ans < i - st) {
            ans = i - st;
            l = st + 1;
        }
    }
    cout << l << " " << ans << '\n';
    return 0;
}
   
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
