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;
int main()
{
int n,q;
cin>>n>>q;
int a[n];
for(int i=0; i<n; ++i)
cin>>a[i];
for(int i=0; i<q; ++i)
{
int type;
cin>>type;
if(type==1)
{
int pos,val;
cin>>pos>>val;
a[pos-1]=val;
}
else
{
int from,to;
cin>>from>>to;
--from;
--to;
int ans(0);
for(int i=from; i<=to; ++i)
{
int freq=(i+1-from)*(to-from+1-i-from);
if(freq%2)
ans^=a[i];
}
cout<<ans<<'\n';
}
}
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... |