# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
571479 | nttt | XOR (IZhO12_xor) | C++14 | 2 ms | 340 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;
#define MASK(i) (1LL << (i))
#define BIT(x, i) ((x >> (i)) & 1)
#define fi first
#define se second
#define ll long long
#define task "C"
const int oo = 1e9 + 7;
const ll loo = (ll)1e18 + 7;
const int MOD = 1e9 + 7;
const int N = 2e6 + 3;
const int BASE = 10;
template <typename T1, typename T2> bool minimize(T1 &a, T2 b)
{
if (a > b) {a = b; return true;} return false;
}
template <typename T1, typename T2> bool maximize(T1 &a, T2 b)
{
if (a < b) {a = b; return true;} return false;
}
ll n, x;
ll a[N];
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
freopen(task".in" , "r" , stdin);
freopen(task".out" , "w" , stdout);
cin >> n >> x;
for (int i = 1; i <= n; i++) cin >> a[i];
pair<int, int> ans;
for (int i = 1; i <= n; i++)
{
ll s = 0;
for (int k = i; k <= n; k++)
{
s ^= a[k];
if(s >= x && k - i > ans.se - ans.fi ) ans = make_pair(i, k);
}
}
cout << ans.fi << " " << ans.se - ans.fi + 1;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |