# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
237576 |
2020-06-07T12:47:16 Z |
Half |
XORanges (eJOI19_xoranges) |
C++14 |
|
763 ms |
8056 KB |
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef long long ll;
#define loop(i,a,b) for (int i = a; i <= b; i++)
#define INF ((unsigned) ~0)
#define F first
#define S second
#define PB push_back
#define MP make_pair
const int MXN = 200000;
int n, q;
int st[2*MXN];
int gi(int i){
if(i % 2 == 0)
return i / 2;
return (n + i) / 2;
}
int rxq(int l, int r){
int res = 0;
for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
if (l&1) res ^= st[l++];
if (r&1) res ^= st[--r];
}
return res;
}
int main(){
cin >> n >> q;
for(int i = 0; i < n; i++)
cin >> st[gi(i) + n];
for(int i = n - 1; i > 1; i--)
st[i] = st[i<<1] ^ st[i<<1|1];
while(q--){
int tp, a, b;
cin >> tp >> a >> b;
a--;
if(tp == 1){
a = gi(a) + n;
st[a] = b;
while(a >= 1){
a = a >> 1;
st[a] = st[a<<1] ^ st[a<<1|1];
}
}else{
b--;
if(a % 2 == b % 2){
cout << rxq(gi(a), gi(b) + 1) << "\n";
}else{
cout << "0\n";
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
384 KB |
Output is correct |
2 |
Correct |
6 ms |
384 KB |
Output is correct |
3 |
Correct |
7 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
6 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
6 ms |
384 KB |
Output is correct |
7 |
Correct |
6 ms |
384 KB |
Output is correct |
8 |
Correct |
7 ms |
384 KB |
Output is correct |
9 |
Correct |
6 ms |
384 KB |
Output is correct |
10 |
Correct |
6 ms |
384 KB |
Output is correct |
11 |
Correct |
18 ms |
512 KB |
Output is correct |
12 |
Correct |
18 ms |
512 KB |
Output is correct |
13 |
Correct |
22 ms |
512 KB |
Output is correct |
14 |
Correct |
22 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
763 ms |
8056 KB |
Output is correct |
2 |
Correct |
747 ms |
7928 KB |
Output is correct |
3 |
Correct |
745 ms |
8056 KB |
Output is correct |
4 |
Correct |
735 ms |
7672 KB |
Output is correct |
5 |
Correct |
726 ms |
7672 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
6 ms |
384 KB |
Output is correct |
7 |
Correct |
6 ms |
384 KB |
Output is correct |
8 |
Correct |
7 ms |
384 KB |
Output is correct |
9 |
Correct |
6 ms |
384 KB |
Output is correct |
10 |
Correct |
6 ms |
384 KB |
Output is correct |
11 |
Correct |
18 ms |
512 KB |
Output is correct |
12 |
Correct |
18 ms |
512 KB |
Output is correct |
13 |
Correct |
22 ms |
512 KB |
Output is correct |
14 |
Correct |
22 ms |
512 KB |
Output is correct |
15 |
Correct |
763 ms |
8056 KB |
Output is correct |
16 |
Correct |
747 ms |
7928 KB |
Output is correct |
17 |
Correct |
745 ms |
8056 KB |
Output is correct |
18 |
Correct |
735 ms |
7672 KB |
Output is correct |
19 |
Correct |
726 ms |
7672 KB |
Output is correct |
20 |
Correct |
581 ms |
7752 KB |
Output is correct |
21 |
Correct |
568 ms |
7672 KB |
Output is correct |
22 |
Correct |
570 ms |
7800 KB |
Output is correct |
23 |
Correct |
706 ms |
7672 KB |
Output is correct |
24 |
Correct |
715 ms |
7672 KB |
Output is correct |