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;
#define ll long long
#define vt vector
#define pb push_back
ll a[5001];
int n, q;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> q;
for(int i = 0; i < n; i++)cin >> a[i];
for(int i = 0; i < q; i++){
int qq; cin >> qq;
if(qq == 2){
int l, r; cin >> l >> r;
ll ans = 0;
l--; r--;
for(int j = l; j <= r; j++){
int val = (j - l + 1) * (r - j + 1);
if(val & 1)ans ^= a[j];
}
cout << ans << "\n";
}else{
int id, x; cin >> id >> x; a[--id] = x;
}
}
}
# | 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... |