#include <bits/stdc++.h>
using namespace std;
#ifdef MIKU
string dbmc = "\033[1;38;2;57;197;187m", dbrs = "\033[0m";
#define debug(x...) cout << dbmc << "[" << #x << "]: ", dout(x)
void dout() { cout << dbrs << endl; }
template <typename T, typename ...U>
void dout(T t, U ...u) { cout << t << (sizeof...(u) ? ", " : ""); dout(u...); }
#else
#define debug(...) 39
#endif
#define fs first
#define sc second
#define mp make_pair
#define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++)
using ll = long long;
typedef pair<int, int> pii;
const int MXN = 200005;
int n, q, a[MXN];
struct BIT {
int n, val[MXN];
void init(int _n) {
n = _n;
fill(val + 1, val + n + 1, 0);
}
void modify(int id, int v) {
for (; id <= n; id += (id & -id)) val[id] ^= v;
}
int query(int id) {
int ans = 0;
for (; id > 0; id -= (id & -id)) ans ^= val[id];
return ans;
}
int query(int l, int r) {
return val[r] ^ val[l - 1];
}
} B0, B1;
void miku() {
cin >> n >> q;
FOR(i, 1, n + 1) cin >> a[i];
B0.init(n / 2 + 1);
B1.init(n / 2 + 1);
FOR(i, 1, n + 1) {
if (i & 1) B1.modify(i / 2 + 1, a[i]);
else B0.modify(i / 2, a[i]);
}
while (q--) {
int t, x, y;
cin >> t >> x >> y;
if (t == 1) {
if (x & 1) B1.modify(x / 2 + 1, y ^ a[x]);
else B0.modify(x / 2, y ^ a[x]);
a[x] = y;
} else {
if ((y - x) & 1) {
cout << 0 << '\n';
} else {
if (y & 1) cout << B1.query(x / 2 + 1, y / 2 + 1) << '\n';
else cout << B0.query(x / 2, y / 2) << '\n';
}
}
}
}
int32_t main() {
cin.tie(0) -> sync_with_stdio(false);
cin.exceptions(cin.failbit);
miku();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2552 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
68 ms |
6504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |