#include <bits/stdc++.h>
using namespace std;
vector<int> even, odd;
void upd(int v, int l, int r, int x, int val)
{
if(l == r)
{
if(l % 2 == 0)
{
even[v] = val;
odd[v] = 0;
}
else
{
even[v] = 0;
odd[v] = val;
}
return;
}
int m = (l + r) / 2;
if(x <= m) upd(v * 2, l, m, x, val);
else upd(v * 2 + 1, m + 1, r, x, val);
odd[v] = odd[v * 2] ^ odd[v * 2 + 1];
even[v] = even[v * 2] ^ even[v * 2 + 1];
}
int get(int v, int l, int r, int tl, int tr, int type)
{
if(tl > tr) return 0;
if(tl == l && tr == r) return type == 0 ? even[v] : odd[v];
int m = (l + r) / 2;
return get(v * 2, l, m, tl, min(tr, m), type) ^ get(v * 2 + 1, m + 1, r, max(tl, m + 1), tr, type);
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n, q;
cin >> n >> q;
int s;
for(int i = 0; i <= 30; i++)
{
if((1 << i) >= n)
{
s = 1 << i;
break;
}
}
even.resize(4 * s);
odd.resize(4 * s);
vector<int> a(s + 1);
for(int i = 1; i <= n; i++)
{
int x;
cin >> x;
a[i] = x;
upd(1, 1, s, i, x);
}
while(q--)
{
int type, l, r;
cin >> type >> l >> r;
if(type == 1)
{
upd(1, 1, n, l, r);
a[l] = r;
}
if(type == 2) cout << get(1, 1, n, l, r, l % 2) << "\n";
}
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/12 | ||||||
1 | Wrong answer | 3ms | 1980 KiB | ||||
2 | Wrong answer | 3ms | 2104 KiB | ||||
3 | Wrong answer | 3ms | 2320 KiB | ||||
4 | Wrong answer | 3ms | 2448 KiB | ||||
5 | Wrong answer | 3ms | 2832 KiB | ||||
subtask2 | 0/18 | ||||||
1 | Wrong answer | 3ms | 3148 KiB | ||||
2 | Wrong answer | 3ms | 3152 KiB | ||||
3 | Wrong answer | 3ms | 3456 KiB | ||||
4 | Wrong answer | 3ms | 3452 KiB | ||||
5 | Wrong answer | 3ms | 3760 KiB | ||||
subtask3 | 0/25 | ||||||
1 | Wrong answer | 7ms | 3960 KiB | ||||
2 | Wrong answer | 7ms | 4116 KiB | ||||
3 | Wrong answer | 7ms | 4112 KiB | ||||
4 | Wrong answer | 7ms | 4112 KiB | ||||
subtask4 | 0/20 | ||||||
1 | Wrong answer | 261ms | 21968 KiB | ||||
2 | Wrong answer | 261ms | 22184 KiB | ||||
3 | Wrong answer | 259ms | 22492 KiB | ||||
4 | Wrong answer | 239ms | 22528 KiB | ||||
5 | Wrong answer | 241ms | 22528 KiB | ||||
subtask5 | 0/25 | ||||||
1 | Wrong answer | 232ms | 22528 KiB | ||||
2 | Wrong answer | 236ms | 22532 KiB | ||||
3 | Wrong answer | 236ms | 22532 KiB | ||||
4 | Wrong answer | 239ms | 22572 KiB | ||||
5 | Wrong answer | 241ms | 22572 KiB |