#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <set>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#define pb push_back
#define pob pop_back
#define pll pair <long long, long long>
#define pld pair <long double, long double>
#define ll long long
#define ull unsigned long long
#define ld long double
#define int ll
#define Int int
#define itn int
#define nit int
#define x first
#define y second
#define all(v) v.begin(),v.end()
#define sz(s) s.size()
#define skip continue
#define equal jlij
#define y0 ijl
#define y1 hjk
#define friend trs
#define delete bae
#define div aber
#define exp earb
#define new aer
#define find find
using namespace std;
const int N = 1e6 + 7;
const int inf = 1e9 + 7;
const int INF = 1e18 + 7;
int a[N];
void solve() {
int n, q;
cin >> n >> q;
for (int i = 1;i <= n;i++)cin >> a[i];
while (q--) {
int type, l, r, pos, x;
cin >> type;
if (type == 1) {
cin >> pos >> x;
a[pos] = x;
}
else {
cin >> l >> r;
int ans = 0;
for (int i = l;i <= r;i++) {
int cnt = (i - l + 1) * (r - i + 1);
if (cnt % 2 == 0)x = 0;
else x = a[i];
ans ^= x;
}
cout << ans << "\n";
}
}
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
t = 1;
while (t--)solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
328 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
328 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
9 ms |
464 KB |
Output is correct |
12 |
Correct |
8 ms |
464 KB |
Output is correct |
13 |
Correct |
35 ms |
472 KB |
Output is correct |
14 |
Correct |
36 ms |
480 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1088 ms |
4332 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
328 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
9 ms |
464 KB |
Output is correct |
12 |
Correct |
8 ms |
464 KB |
Output is correct |
13 |
Correct |
35 ms |
472 KB |
Output is correct |
14 |
Correct |
36 ms |
480 KB |
Output is correct |
15 |
Execution timed out |
1088 ms |
4332 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |