记录编号 |
163684 |
评测结果 |
AAAAAAAAAA |
题目名称 |
zwei |
最终得分 |
100 |
用户昵称 |
0 |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.252 s |
提交时间 |
2015-05-25 16:08:44 |
内存使用 |
1.07 MiB |
显示代码纯文本
# include <iostream>
# include <cstdio>
# include <cstring>
using namespace std;
int n,m;
int a[100005],c[100005];
inline int in() {
char c=getchar();
int x=0;
while(c<'0'||c>'9')c=getchar();
for(; c>='0'&&c<='9'; c=getchar())x=x*10+c-'0';
return x;
}
int lowbit(int x) {
return x&(-x);
}
void up(int x,int add) {
while (x<=100005) {
c[x] = c[x]^add;
x += lowbit(x);
}
}
int sum(int x) {
int sum2=0;
while (x>0) {
sum2 = sum2^c[x];
x -= lowbit(x);
}
return sum2;
}
int main() {
freopen("zwei.in", "r", stdin);
freopen("zwei.out", "w", stdout);
n=in();m=in();
for (int i=1; i<=n; ++i) {
a[i]=in();
up(i,a[i]);
}
for (int i=1; i<=m; ++i) {
int q,x,y;
q=in();
if (q) {
x=in();y=in();
int s = sum(y)^sum(x-1);
printf("%d\n", s);
} else {
x=in();y=in();
up(x,a[x]);
up(x,y);
a[x] = y;
}
}
return 0;
}