# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
971940 | 2024-04-29T14:13:15 Z | vjudge1 | XORanges (eJOI19_xoranges) | C++17 | 108 ms | 9608 KB |
#include <bits/stdc++.h> typedef long long ll; using namespace std; const int N = 2e5 + 5; int a[N], n, q; ll bit[2][N]; void upd(int x, int i, ll val){ for(++i; i<N; i+=i&-i) bit[x][i] ^= val; } ll qry(int x, int i){ ll res = 0; for(++i; i; i-=i&-i) res ^= bit[x][i]; return res; } ll sum(int x, int l, int r){ return qry(x, r) ^ qry(x, l-1); } signed main(){ scanf("%d %d", &n, &q); for(int i = 0; i<n; ++i) scanf("%d", a+i); for(int i = 0; i<n; ++i){ upd(i&1, i>>1, a[i]); } while(q--){ int t; scanf("%d", &t); if(t == 1){ int i, val; scanf("%d %d", &i, &val); --i; upd(i&1, i>>1, val ^ a[i]); a[i] = val; }else if(t == 2){ int l, r; scanf("%d %d", &l, &r); --l; --r; ll T = 0; if((r-l+1)&1){ if(!(l&1)){ int R = r; if(R&1) --R; T = sum(0, l>>1, R>>1); }else if(l&1){ int R = r; if(!(R&1)) --R; T = sum(1, l>>1, R>>1); } } printf("%lld\n", T); } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2392 KB | Output is correct |
2 | Correct | 1 ms | 2652 KB | Output is correct |
3 | Correct | 1 ms | 2392 KB | Output is correct |
4 | Correct | 1 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2392 KB | Output is correct |
2 | Correct | 1 ms | 2652 KB | Output is correct |
3 | Correct | 1 ms | 2392 KB | Output is correct |
4 | Correct | 1 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
6 | Correct | 1 ms | 2396 KB | Output is correct |
7 | Correct | 1 ms | 2396 KB | Output is correct |
8 | Correct | 1 ms | 2396 KB | Output is correct |
9 | Correct | 1 ms | 2396 KB | Output is correct |
10 | Correct | 1 ms | 2396 KB | Output is correct |
11 | Correct | 3 ms | 2612 KB | Output is correct |
12 | Correct | 2 ms | 2652 KB | Output is correct |
13 | Correct | 3 ms | 2652 KB | Output is correct |
14 | Correct | 3 ms | 2652 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 108 ms | 4692 KB | Output is correct |
2 | Correct | 86 ms | 9552 KB | Output is correct |
3 | Correct | 86 ms | 9608 KB | Output is correct |
4 | Correct | 94 ms | 9128 KB | Output is correct |
5 | Correct | 85 ms | 9156 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2392 KB | Output is correct |
2 | Correct | 1 ms | 2652 KB | Output is correct |
3 | Correct | 1 ms | 2392 KB | Output is correct |
4 | Correct | 1 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
6 | Correct | 1 ms | 2396 KB | Output is correct |
7 | Correct | 1 ms | 2396 KB | Output is correct |
8 | Correct | 1 ms | 2396 KB | Output is correct |
9 | Correct | 1 ms | 2396 KB | Output is correct |
10 | Correct | 1 ms | 2396 KB | Output is correct |
11 | Correct | 3 ms | 2612 KB | Output is correct |
12 | Correct | 2 ms | 2652 KB | Output is correct |
13 | Correct | 3 ms | 2652 KB | Output is correct |
14 | Correct | 3 ms | 2652 KB | Output is correct |
15 | Correct | 108 ms | 4692 KB | Output is correct |
16 | Correct | 86 ms | 9552 KB | Output is correct |
17 | Correct | 86 ms | 9608 KB | Output is correct |
18 | Correct | 94 ms | 9128 KB | Output is correct |
19 | Correct | 85 ms | 9156 KB | Output is correct |
20 | Correct | 80 ms | 9300 KB | Output is correct |
21 | Correct | 81 ms | 9296 KB | Output is correct |
22 | Correct | 83 ms | 9300 KB | Output is correct |
23 | Correct | 98 ms | 9452 KB | Output is correct |
24 | Correct | 84 ms | 9140 KB | Output is correct |