# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1099461 | vjudge1 | XORanges (eJOI19_xoranges) | C++17 | 411 ms | 11092 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 int long long
signed main()
{
int n, q; cin >> n >> q;
vector<int> a(n + 1);
vector<int> odd(n + 1), even(n + 1);
for (int i = 1; i <= n; i++){
cin >> a[i];
if (i % 2 == 0){
even[i] ^= even[i - 2] ^ a[i];
}else if (i % 2 == 1){
if (i == 1) odd[i] = a[i];
else odd[i] ^= odd[i - 2] ^ a[i];
}
}
while(q--){
int t, l, u; cin >> t >> l >> u;
int x = 0;
if (t == 2){
if ((u - l + 1) % 2 == 0){
cout << 0 << endl;
}else{
if (u % 2 == 0){
cout << (even[u] ^ even[l - 2] )<< endl;
}else{
if (l == 1) cout << odd[u] << endl;
else cout << (odd[u] ^ odd[l - 2]) << endl;
}
}
}else{
a[l] = u;
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |