比赛 |
20131026 |
评测结果 |
AAAAAAAAAA |
题目名称 |
zwei |
最终得分 |
100 |
用户昵称 |
lenibomb |
运行时间 |
0.388 s |
代码语言 |
C++ |
内存使用 |
1.46 MiB |
提交时间 |
2015-09-12 21:23:57 |
显示代码纯文本
# include <iostream>
# include <cstdio>
using namespace std;
int n,m;
int a[150000],c[150000];
int lowbit(int x)
{
return x&(-x);
}
void nnew(int x,int y)
{
while (x<=100001)
{
c[x] = c[x]^y;
x += lowbit(x);
}
}
int sum(int x)
{
int summ=0;
while (x>0)
{
summ = summ^c[x];
x -= lowbit(x);
}
return summ;
}
int main()
{
freopen("zwei.in","r",stdin);
freopen("zwei.out","w",stdout);
scanf("%d%d", &n, &m);
for (int i=1;i<=n;++i)
{
scanf("%d", &a[i]);
nnew(i,a[i]);
}
for (int i=1;i<=m;++i)
{
int flag,x,y;
scanf("%d%d%d", &flag,&x, &y);
if (flag!=0)
{
int aa = sum(y)^sum(x-1);
printf("%d\n", aa);
}
else
{
nnew(x,a[x]);
nnew(x,y);
a[x] = y;
}
}
//while(1);
}