Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:用线段树怎么实现最后一个操作呢?寻找最大连续空缺

Posted by 1215359639 at 2011-04-23 22:24:25 on Problem 1823
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator