# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1067632 | raduv | XORanges (eJOI19_xoranges) | C++14 | 102 ms | 8788 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>
const int MAXN = 2e5;
using namespace std;
int aib[2][MAXN + 1];
int v[MAXN + 1];
void update(int poz, int x, int n){
int i;
for( i = poz; i <= n; i += i & -i){
aib[poz & 1][i] ^= x;
}
}
int query(int poz, int par){
int rez = 0, i;
for( i = poz; i > 0; i = (i & (i - 1))){
rez ^= aib[par][i];
}
return rez;
}
int main(){
int n, q, i, op, l, r;
scanf("%d%d", &n, &q);
for( i = 1; i <= n; i++ ){
scanf("%d", &v[i]);
update(i, v[i], n);
}
for( i = 0; i < q; i++ ){
scanf("%d%d%d", &op, &l, &r);
if(op == 1){
update(l, v[l], n);
update(l, r, n);
v[l] = r;
}
else{
if( (r - l) & 1 ){
printf("0\n");
}
else{
printf("%d\n", query(r, r & 1) ^ query(l - 1, l & 1));
}
}
}
return 0;
}
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... |