type rec=record lc,rc,v,rnd,size,w,fa:longint; end; var n,root,tot,ans,opt,x,i,po:longint; tr:array[0..100000] of rec; procedure rotl(po:longint); var y:longint; begin y:=tr[po].rc; tr[po].rc:=tr[y].lc; if tr[y].lc>0 then tr[tr[y].lc].fa:=po; tr[y].f…