记录编号 128880 评测结果 AAAAAAAAAA
题目名称 zwei 最终得分 100
用户昵称 Gravatar东方老败 是否通过 通过
代码语言 Pascal 运行时间 1.151 s
提交时间 2014-10-18 18:43:46 内存使用 0.93 MiB
显示代码纯文本
type point=^note;
     note=record
	    l,r,da:int64;
		lc,rc:point;
		end;

var p,q:point;
    n,m,i,j,k,o1,o2,o3:longint;
	a:array[1..100000]of int64;

procedure build(x,y:longint;z:point);
begin
z^.l:=x;
z^.r:=y;
if (x=y) then begin z^.da:=a[x];exit;end;
new(z^.lc);
build(x,(x+y)div 2,z^.lc);
new(z^.rc);
build((x+y)div 2+1,y,z^.rc);
z^.da:=z^.lc^.da xor z^.rc^.da;
end;

procedure change(x,y:longint;z:point);
begin
if (z^.lc=z^.rc) then begin z^.da:=y;exit;end;
if x<=(z^.l+z^.r)>>1 then change(x,y,z^.lc)
else change(x,y,z^.rc);
z^.da:=z^.lc^.da xor z^.rc^.da;
end;

function query(x,y:longint;z:point):longint;
var u,v:longint;
begin
if (x<=z^.l)and(z^.r<=y) then exit(z^.da);
u:=0;v:=0;
if x<=(z^.l+z^.r)>>1 then u:=query(x,y,z^.lc);
if y>(z^.l+z^.r)>>1 then v:=query(x,y,z^.rc);
exit(u xor v);
end;

begin
assign(input,'zwei.in');reset(input);
assign(output,'zwei.out');rewrite(output);
readln(n,m);
for i:=1 to n do read(a[i]);
new(p);
build(1,n,p);
for i:=1 to m do
begin
 readln(o1,o2,o3);
 if o1=0 then change(o2,o3,p);
 if o1=1 then writeln(query(o2,o3,p)) ;
end;
close(input);close(output);
end.