#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define sz(x) (int)x.size()
#define MASK(i) ((1LL) << (i))
#define all(x) x.begin(), x.end()
#define BIT(x, i) ((x) >> (i) & (1LL))
#define dbg(...) cerr << "#" << __LINE__ << ":[" << #__VA_ARGS__ \
<< "] = [" ,DBG(__VA_ARGS__)
string to_string(const string& s) { return '"' + s + '"'; }
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
cerr << to_string(h); if(sizeof...(t)) cerr << ", "; DBG(t...);
}
template <class T>
inline bool maximize(T &a, const T &b) { return (a < b ? (a = b, 1) : 0); }
template <class T>
inline bool minimize(T &a, const T &b) { return (a > b ? (a = b, 1) : 0); }
const int MAXN = 2e5 + 6;
const int INF = 1e9;
const int MOD = 1e9 + 7;
int n, q, a[MAXN];
void solve() {
cin >> n >> q;
for (int i = 1; i <= n; i++) cin >> a[i];
while (q--) {
int t, u, v;
cin >> t >> u >> v;
if (t == 1) a[u] = v;
else {
int res = 0;
for (int i = u; i <= v; i++) {
int cnt = (i - u + 1) * (v - i + 1);
if (cnt & 1) res ^= a[i];
}
cout << res << '\n';
}
}
}
#define TASK ""
int32_t main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//freopen(TASK".inp", "r", stdin);
//freopen(TASK".out", "w", stdout);
int ntest = 1;
//cin >> ntest;
while (ntest--) solve();
return 0;
}
//612
# |
결과 |
실행 시간 |
메모리 |
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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
5 ms |
600 KB |
Output is correct |
12 |
Correct |
5 ms |
604 KB |
Output is correct |
13 |
Correct |
18 ms |
772 KB |
Output is correct |
14 |
Correct |
19 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1060 ms |
4548 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
5 ms |
600 KB |
Output is correct |
12 |
Correct |
5 ms |
604 KB |
Output is correct |
13 |
Correct |
18 ms |
772 KB |
Output is correct |
14 |
Correct |
19 ms |
604 KB |
Output is correct |
15 |
Execution timed out |
1060 ms |
4548 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |