Submission #1172177

#TimeUsernameProblemLanguageResultExecution timeMemory
1172177shahodXOR (IZhO12_xor)C++20
0 / 100
0 ms320 KiB
#include <bits/stdc++.h>
using namespace std;

void gojo() {
    int n, x;
    cin >> n >> x;

    vector<int> pre(n + 1);
    for (int i = 1, x; i <= n; i++) {
        cin >> x;
        pre[i] = pre[i - 1] ^ x;
    }

    int l = 1, r = n, st = -1, k = 0;
    while (l <= r) {
        int md = (l + r) / 2, j = -1;

        for (int i = 0; i <= n - md; i++) {
            if ((pre[i] ^ pre[i + md]) >= x) {
                j = i;
                break;
            }
        }

        if (~j) {
            st = j, k = md;
            l = md + 1;
        } else {
            r = md - 1;
        }
    }

    cout << st + 1 << ' ' << k;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    // cin >> t;

    while (t--) {
        gojo();
        cout << '\n';
    }

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...