splay区间反转
我的WScode:
type
tree=record
f,l,r,bg,size:longint;
end;
var
root,n,m,i,j,x,y,l,r:longint;
t:array[0..500000] of tree;
procedure ch(x:longint);
begin
if t[x].bg=1 then
t[x].bg:=0
else t[x].bg:=1;
end;
procedure down(x:longint);
var sw:longint;
begin
if x<>0 then
if t[x].bg=1 then
begin
if t[x].l<>0 then
ch(t[x].l);
if t[x].r<>0 then
ch(t[x].r);
sw:=t[x].l;
t[x].l:=t[x].r;
t[x].r:=sw;
t[x].bg:=0;
end;
end;
procedure left(p:longin......
阅读全文