# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1140360 | samy_nagy | XOR (IZhO12_xor) | C++20 | 28 ms | 33344 KiB |
#include <bits/stdc++.h>
/// لتكن مشيئتك
#define int long long
#define ll long long
using namespace std;
const int N = 1e3 + 5, mod = 1e9 + 7;// 1e9+7, 998244353
/**
You have another chance now the decision is yours
*/
void solve() {
int n, x;
cin >> n >> x;
int a[n];
for (int i = 0; i < n and cin >> a[i]; ++i) {
}
for (int k = n; k > 0; --k) {
int c = 0;
for (int i = 0; i < k; ++i) {
c ^= a[i];
}
if (c >= x) {
cout << 1 << " " << k;
return;
}
for (int i = k; i < n; ++i) {
c ^= a[i - k];
c ^= a[i];
if (c >= x) {
cout << i - k + 2 << " " << k;
return;
}
}
}
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
int tc = 1;
// cin >> tc;
for (int i = 1; i <= tc; ++i) {
solve();
// cout << "\n";
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |