# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
446724 | fuad27 | XORanges (eJOI19_xoranges) | C++14 | 666 ms | 3936 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 pass true
int main () {
int n, q;
cin >> n >> q;
vector<int> prefix(n+1, 0);
vector<int> prefixOdd(n+1, 0);
vector<int> v(n, 0);
bool check = false;
for(int i = 0;i<n;i++) {
int p;
cin >> p;
prefix[i+1] = prefix[i] ^ p;
if(i%2 == 0) {
prefixOdd[i+1] = prefixOdd[i] ^ p;
}
else {
prefixOdd[i+1] = prefixOdd[i];
}
v[i] = p;
}
while(q--) {
int k;
cin >> k;
if(k == 1) {
check = true;
int i, j;
cin >> i >> j;
v[i-1] = j;
}
else {
int l, u;
cin >> l >> u;
if(!check) {
if((u - l)%2 == 0) {
if(l%2 == 1) {
int ans = prefixOdd[u] ^ prefixOdd[l-1];
cout<<(ans)<<endl;
}
else {
int ans = prefix[u] ^ prefixOdd[u] ^ prefix[l-1] ^ prefixOdd[l-1];
cout<<ans<<endl;
}
}
else {
cout<<0<<endl;
}
}
else {
pass;
}
}
}
}
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... |