# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
649471 |
2022-10-10T09:10:39 Z |
ymm |
XORanges (eJOI19_xoranges) |
C++17 |
|
96 ms |
7628 KB |
#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (ll)(r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (ll)(l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;
const int N = 200'010;
int arr[2][N];
int fen[2][N];
int n, q;
void up(int i, int x, int *fen)
{
++i;
while (i < N) {
fen[i] ^= x;
i += i & -i;
}
}
int get(int r, int *fen)
{
int ans = 0;
while (r > 0) {
ans ^= fen[r];
r ^= r & -r;
}
return ans;
}
int get(int l, int r, int *fen)
{
return get(r, fen) ^ get(l, fen);
}
int main()
{
cin.tie(0) -> sync_with_stdio(false);
cin >> n >> q;
Loop (i,0,n) {
cin >> arr[i&1][i/2];
up(i/2, arr[i&1][i/2], fen[i&1]);
}
while (q--) {
int t, x, y;
cin >> t >> x >> y;
if (t == 1) {
--x;
up(x/2, arr[x&1][x/2] ^ y, fen[x&1]);
arr[x&1][x/2] = y;
}
if (t == 2) {
--x; --y;
if (x%2 != y%2)
cout << "0\n";
else
cout << get(x/2, y/2+1, fen[x&1]) << '\n';
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
2 ms |
340 KB |
Output is correct |
12 |
Correct |
2 ms |
448 KB |
Output is correct |
13 |
Correct |
3 ms |
340 KB |
Output is correct |
14 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
80 ms |
3032 KB |
Output is correct |
2 |
Correct |
89 ms |
3032 KB |
Output is correct |
3 |
Correct |
87 ms |
3092 KB |
Output is correct |
4 |
Correct |
92 ms |
3032 KB |
Output is correct |
5 |
Correct |
80 ms |
7628 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
2 ms |
340 KB |
Output is correct |
12 |
Correct |
2 ms |
448 KB |
Output is correct |
13 |
Correct |
3 ms |
340 KB |
Output is correct |
14 |
Correct |
2 ms |
340 KB |
Output is correct |
15 |
Correct |
80 ms |
3032 KB |
Output is correct |
16 |
Correct |
89 ms |
3032 KB |
Output is correct |
17 |
Correct |
87 ms |
3092 KB |
Output is correct |
18 |
Correct |
92 ms |
3032 KB |
Output is correct |
19 |
Correct |
80 ms |
7628 KB |
Output is correct |
20 |
Correct |
90 ms |
7612 KB |
Output is correct |
21 |
Correct |
96 ms |
7608 KB |
Output is correct |
22 |
Correct |
86 ms |
7592 KB |
Output is correct |
23 |
Correct |
83 ms |
7624 KB |
Output is correct |
24 |
Correct |
80 ms |
7616 KB |
Output is correct |