#include<bits/stdc++.h>
using namespace std;
unsigned int ulutoplam=0;
unsigned int sayilar[200005];
void guncel(unsigned int indis,unsigned int sayi) {
ulutoplam^=sayilar[indis];
sayilar[indis]=sayi;
ulutoplam^=sayilar[indis];
}
unsigned int yap(int l,int r) {
unsigned int sonuc=0;
for (int i = 1; i <= r-l+1; i++)
{
if(i%2){
int indi=r;
for (int j = 0; j < i; j++)
{
if(j %2){
sonuc ^=sayilar[j+l];
sonuc^=sayilar[indi];
}
indi--;
}
sonuc^=ulutoplam;
}
else{
int bindi=r;
for (int j = 0; j < i; j++)
{
if(!(j %2)){
sonuc ^=sayilar[j+l];
sonuc^=sayilar[bindi];
}
bindi--;
}
}
}
return sonuc;
}
int main() {
cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false);
int n,q;
cin >> n >> q;
for (int i = 1; i <= n; i++)
{
cin >> sayilar[i];
ulutoplam^=sayilar[i];
}
for (int i = 0; i < q; i++)
{
unsigned int sayi1,sayi2,sayi3;
cin >> sayi1 >> sayi2>> sayi3;
if(sayi1==1)
guncel(sayi2,sayi3);
else
cout << yap(sayi2,sayi3)<<endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
15 ms |
324 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1088 ms |
1076 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |