#include<bits/stdc++.h>
#include<math.h>
#define _USE_MATH_DEFINES
using namespace std;
struct seg_tree{
vector<int> seg;
int n;
void build(int l, int r, int ind, vector<int>&a){
if(l == r) {
seg[ind] = a[l];
return;
}
int mid = (l + r) / 2;
build(l, mid, ind*2 + 1, a);
build(mid+1, r, ind*2 + 2, a);
seg[ind] = seg[ind*2 +1] ^ seg[ind*2 + 2];
}
seg_tree(vector<int>& a){
n = a.size();
seg.resize(4*n, 0);
build(0, n-1, 0, a);
}
int query(int l, int r, int ind, int currL, int currR){
if(l >= currL && r <= currR) return seg[ind];
else if(currL > r || currR < l) return 0;
int mid = (l + r) / 2;
return query(l, mid, ind*2 + 1, currL, currR) ^ query(mid+1, r, ind*2 + 2, currL, currR);
}
int query(int currL, int currR){
return query(0, n-1, 0, currL, currR);
}
void update(int l, int r, int ind, int pos, int val){
if(l == r) {
seg[ind] = val;
return;
}
int mid = (l + r)/2;
if(pos <= mid){
update(l, mid, ind*2+1, pos, val);
}
else{
update(mid+1, r, ind*2+2, pos, val);
}
seg[ind] = seg[ind*2 +1] ^ seg[ind*2 + 2];
}
void update(int pos, int val){
update(0, n-1, 0, pos, val);
}
};
int main()
{
cout << 2 << endl;
cout << 0 << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |