제출 #589074

#제출 시각아이디문제언어결과실행 시간메모리
589074promaXOR (IZhO12_xor)C++17
0 / 100
1 ms336 KiB
#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 << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...