#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int n;cin>>n;
int q;cin>>q;
vector<int> nums(n);
for(int i = 0 ; i < n ; i++){
cin>>nums[i];
}
for(int _=0;_<q;_++){
int type;cin>>type;
if(type==1){
int pos;cin>>pos;pos--;
int val;cin>>val;
nums[pos]=val;
}else{
int l,r;cin>>l>>r;
l--;r--;
int ans=0;
for(int i = l;i<=r;i++){
int left = abs(l-i)+1;
int right= abs(r-i)+1;
int parity = (left*right)&1;
if(parity){
ans^=nums[i];
}
}
cout<<ans<<endl;
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
296 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
308 KB |
Output is correct |
4 |
Correct |
2 ms |
212 KB |
Output is correct |
5 |
Correct |
2 ms |
304 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
296 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
2 ms |
308 KB |
Output is correct |
9 |
Correct |
2 ms |
212 KB |
Output is correct |
10 |
Correct |
2 ms |
304 KB |
Output is correct |
11 |
Correct |
12 ms |
456 KB |
Output is correct |
12 |
Correct |
11 ms |
468 KB |
Output is correct |
13 |
Correct |
32 ms |
440 KB |
Output is correct |
14 |
Correct |
33 ms |
456 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1077 ms |
2452 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
296 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
2 ms |
308 KB |
Output is correct |
9 |
Correct |
2 ms |
212 KB |
Output is correct |
10 |
Correct |
2 ms |
304 KB |
Output is correct |
11 |
Correct |
12 ms |
456 KB |
Output is correct |
12 |
Correct |
11 ms |
468 KB |
Output is correct |
13 |
Correct |
32 ms |
440 KB |
Output is correct |
14 |
Correct |
33 ms |
456 KB |
Output is correct |
15 |
Execution timed out |
1077 ms |
2452 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |