# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1048942 | Nickpapadak | XORanges (eJOI19_xoranges) | C++14 | 1065 ms | 6172 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
const unsigned int MAXN = 2e+5 + 10;
bool mp[MAXN];
int pf[MAXN], a[MAXN];
int N, Q;
int main(){
scanf("%d%d",&N,&Q);
// mp.resize(N+1, 0);
for(int i = 1; i<=N;++i){
scanf("%d",&a[i]);
pf[i] = pf[i-1] ^ a[i];
mp[i] = 0;
}
while(Q--){
int s,b, type;
scanf("%d%d%d", &type, &s, &b);
if(type == 2){
int ans = 0;
// for(int i = 1; i <= b-s+1; ++i){
// for(int j = s; j+i-1 <= b;++j){
// ans ^= (pf[j+i-1] ^ pf[j-1]);
// // changemp(j+i-1);
// // changemp(j+i-1);
// for(int k = j; k <= j+i-1; ++k) mp[k] = !mp[k];
// // mp[j+i-1] = !mp[j+i-1];
// // mp[j-1] = !mp[j-1];
// }
// }`
if((b-s+1) % 2 == 1){
for(int j = s; j <= b; j+=2){
ans ^= a[j];
}
}
// for(int i = 1; i<=N;++i){
// printf("[%d]", i);
// }
// printf("\n");
// for(int i = 1; i<=N;++i){
// printf(" %d ", mp[i]);
// mp[i] = 0;
// }
// printf("\n");
printf("%d\n", ans);
}else{
a[s] = b;
for(int i = s; i<=N;++i){
pf[i] = pf[i-1] ^ a[i];
}
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |