# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
467134 | radaiosm7 | XORanges (eJOI19_xoranges) | C++98 | 134 ms | 3816 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;
int n, q, i, a, b, quer;
int c[200005];
int fen[2][200005];
void Update() {
for (int indx=a; indx <= n; indx += (indx&(-indx))) fen[a&1][indx] ^= b^c[a];
c[a] = b;
}
int Query(int indx) {
int x = 0;
for (; indx > 0; indx -= (indx&(-indx))) x ^= fen[a&1][indx];
return x;
}
int main() {
scanf("%d%d", &n, &q);
for (i=1; i <= n; ++i) scanf("%d", &c[i]);
for (i=1; i <= n; ++i) {
a = i;
b = c[i];
c[i] = 0;
Update();
}
fen[0][0] = 0;
fen[1][0] = 0;
while (q--) {
scanf("%d%d%d", &quer, &a, &b);
if (quer == 1) Update();
else if ((a&1) != (b&1)) printf("0\n");
else printf("%d\n", Query(b)^Query(a-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... |