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>
#include <iostream>
#include <set>
#include <cmath>
#include <iterator>
#include <vector>
#define ff first
#define ss second
#define mp make_pair
#define ll long long
using namespace std;
int main() {
int n, q;
cin >> n >> q;
int a[n];
for (int i = 0; i < n; i++){
cin >> a[i];
}
if (n <= 5000 && q <= 5000){
for (int lol = 0; lol < q; lol++){
int x, y, z;
cin >> x >> y >> z;
if (x == 1) {a[y - 1] = z;}
else {
if ((z - y) % 2 == 1) {cout << "0" << endl; continue;}
int p = a[y - 1];
for (int i = y + 1; i < z; i = i + 2){
p = (p ^ a[i]);
}
cout << p << endl;
}
}
} else {
int b[n];
b[0] = a[0]; b[1] = b[1];
for (int i = 2; i < n; i++){
b[i] = (b[i - 2] ^ a[i]);
}
for (int lol = 0; lol < q; lol++){
int x, y, z;
cin >> x >> y >> z;
if (x == 1) {a[y - 1] = z;}
else {
if ((z - y) % 2 == 1) {cout << "0" << endl;} else {
int p = ((b[z - 1] ^ b[y - 1]) ^ a[y - 1]);
cout << p << endl;
}
}
}
}
return 0;
}
# | 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... |