#include <bits/stdc++.h>
#include <unistd.h>
#define X first
#define Y second
#define ll long long
#define pii pair<int, int>
#define pb push_back
#define vec vector
#define pri(i, poc, n, pov) for(int i = (int) poc; i < (int) n; i += (int) pov)
#define od(i, poc, n, pov) for(int i = (int) poc; i > (int) n; i -= (int) pov)
using namespace std;
const int LOG = 20;
const int OFF = (1 << LOG);
const int N = 1e6;
struct node{
int sum[2] = {0, 0};
} tour[32][N];
int n, q;
void update(int t, int x, int val){
x += OFF;
tour[t][x].sum[x % 2] = val;
x /= 2;
while(x){
pri(i, 0, 2, 1)
tour[t][x].sum[i] = tour[t][x * 2].sum[i] + tour[t][x * 2 + 1].sum[i];
x /= 2;
}
}
int query(int t, int b, int l, int r, int lo = 0, int hi = OFF, int x = 1){
if(r <= lo || hi <= l) return 0;
if(l <= lo && hi <= r) return tour[t][x].sum[b];
int mi = (lo + hi) / 2;
return query(t, b, l, r, lo, mi, x * 2) + query(t, b, l, r, mi, hi, x * 2 + 1);
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> q;
pri(i, 0, n, 1){
int x;
cin >> x;
// pri(j, 0, 32, 1){
// bool b = (x & (1 << j)) > 0;
// update(j, i, b);
// }
}
pri(i, 0, q, 1){
int t, x, y;
cin >> t >> x >> y;
if(t == 1){
// pri(j, 0, 32, 1){
// bool b = (y & (1 << j)) > 0;
// update(j, x - 1, b);
// }
} else {
int ans = 0;
x--;
y--;
// int p = (y - x + 1) % 2;
// if(!p){
// cout << 0 << "\n";
// continue;
// }
// pri(j, 0, 32, 1){
// int res = query(j, x % 2, x, y + 1);
// ans += (1 << j) * (res % 2);
// }
cout << ans << "\n";
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
93 ms |
640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |