#include <bits/stdc++.h>
using namespace std;
#define int long long
#define debug(x) cout << #x << " " << (x) << endl;
#define all(x) x.begin(), x.end()
void pp(pair<int, int>&a) { cout << "{" << a.first << ", " << a.second << endl; }
void g(vector<int>&a) { cout << "{"; for (auto el : a) cout << el << ", "; cout << "}" << endl; }
void g(vector<pair<int, int>>&a) { cout << "{"; for (auto el : a) pp(el); cout << "}" << endl; }
// #define DBG
void solve() {
int n,q;cin>>n>>q;
vector<int> a(n);
for (int i = 0; i < n; i++) cin >> a[i];
while (q--) {
int t,x,y;cin>>t>>x>>y;
if (t==1) {
// upd
a[x-1] = y;
} else {
if ((y-x+1) % 2 == 0) cout << 0 << endl;
else {
int xo = 0;
for (int i = x-1; i <= y-1; i += 2) xo ^= a[i];
cout << xo << endl;
}
}
}
// g(a);
}
int32_t main() {
ios_base::sync_with_stdio(0);cin.tie(NULL);
int t=1;
#ifdef DBG
freopen("inp1.txt", "r", stdin);
freopen("out.txt", "w", stdout);
cin>>t;
#endif
while (t--) {
solve();
cout << endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
600 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
600 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
2 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
4 ms |
604 KB |
Output is correct |
12 |
Correct |
7 ms |
604 KB |
Output is correct |
13 |
Correct |
14 ms |
604 KB |
Output is correct |
14 |
Correct |
8 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1095 ms |
2940 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
600 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
2 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
4 ms |
604 KB |
Output is correct |
12 |
Correct |
7 ms |
604 KB |
Output is correct |
13 |
Correct |
14 ms |
604 KB |
Output is correct |
14 |
Correct |
8 ms |
604 KB |
Output is correct |
15 |
Execution timed out |
1095 ms |
2940 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |