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()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n,q;
cin>>n>>q;
int arr[n];
for(int i=0; i<n; ++i)
cin>>arr[i];
for(int i=0; i<q; ++i)
{
int type;
cin>>type;
if(type==1)
{
int x,y;
cin>>x>>y;
--x;
arr[x]=y;
}
else
{
int x,y;
cin>>x>>y;
--x;
--y;
int ans(0);
for(int j=x; j<=y; ++j)
{
int freq=(j-x+1)*(n-(j-x));
if(freq%2)
ans^=arr[j];
}
cout<<ans<<"\n";
}
}
}
# | 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... |