#include <stdio.h>
#include <ctype.h>
#pragma GCC optimize("O3", "unroll-loops", "Ofast")
#pragma GCC target ("avx2")
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;
}
static inline int getInt(){
int n = 0, ch;
while(!isdigit(ch = getc(stdin)));
do
n = n * 10 + ch - '0';
while (isdigit(ch = getc(stdin)));
return n;
}
int main(){
int n, q, i, op, l, r;
n = getInt();
q = getInt();
for( i = 1; i <= n; i++ ){
v[i] = getInt();
update(i, v[i], n);
}
for( i = 0; i < q; i++ ){
op = getInt();
l = getInt();
r = getInt();
if(op == 1){
update(l, v[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;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
620 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
604 KB |
Output is correct |
14 |
Correct |
1 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
8532 KB |
Output is correct |
2 |
Correct |
36 ms |
8488 KB |
Output is correct |
3 |
Correct |
31 ms |
8524 KB |
Output is correct |
4 |
Correct |
29 ms |
8252 KB |
Output is correct |
5 |
Correct |
30 ms |
8272 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
620 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
604 KB |
Output is correct |
14 |
Correct |
1 ms |
604 KB |
Output is correct |
15 |
Correct |
32 ms |
8532 KB |
Output is correct |
16 |
Correct |
36 ms |
8488 KB |
Output is correct |
17 |
Correct |
31 ms |
8524 KB |
Output is correct |
18 |
Correct |
29 ms |
8252 KB |
Output is correct |
19 |
Correct |
30 ms |
8272 KB |
Output is correct |
20 |
Correct |
32 ms |
8284 KB |
Output is correct |
21 |
Correct |
33 ms |
8276 KB |
Output is correct |
22 |
Correct |
31 ms |
8236 KB |
Output is correct |
23 |
Correct |
31 ms |
8088 KB |
Output is correct |
24 |
Correct |
29 ms |
8024 KB |
Output is correct |