#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 |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
288 KB |
Output is correct |
2 |
Correct |
3 ms |
256 KB |
Output is correct |
3 |
Correct |
4 ms |
256 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
3 ms |
288 KB |
Output is correct |
7 |
Correct |
3 ms |
256 KB |
Output is correct |
8 |
Correct |
4 ms |
256 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
384 KB |
Output is correct |
11 |
Correct |
27 ms |
512 KB |
Output is correct |
12 |
Correct |
24 ms |
512 KB |
Output is correct |
13 |
Correct |
48 ms |
512 KB |
Output is correct |
14 |
Correct |
46 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1067 ms |
3504 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
3 ms |
288 KB |
Output is correct |
7 |
Correct |
3 ms |
256 KB |
Output is correct |
8 |
Correct |
4 ms |
256 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
384 KB |
Output is correct |
11 |
Correct |
27 ms |
512 KB |
Output is correct |
12 |
Correct |
24 ms |
512 KB |
Output is correct |
13 |
Correct |
48 ms |
512 KB |
Output is correct |
14 |
Correct |
46 ms |
512 KB |
Output is correct |
15 |
Execution timed out |
1067 ms |
3504 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |