Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:用线段树怎么实现最后一个操作呢?寻找最大连续空缺In Reply To:用线段树怎么实现最后一个操作呢?寻找最大连续空缺 Posted by:TN at 2005-05-16 12:24:24 function query(x:longint):longint; var z,w:longint; begin clean(x); if total[x]=ll[x] then exit(total[x]); w:=0; w:=max(w,ll[x]); w:=max(w,rr[ls[x]]+ll[rs[x]]); w:=max(w,rr[x]); if ls[x]<>0 then w:=max(w,query(ls[x])); if rs[x]<>0 then w:=max(w,query(rs[x])); exit(w); end; total,ll,rr数组和poj3667用途一样 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator