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

左偏树应用

Posted by yc5_yc at 2012-07-04 21:08:53 on Problem 3666
先把每个值单独开一个堆,将第一个入栈,从第二个开始,让当前项入栈,让栈顶跟第二项比,若小于第二项,即两项合并成新的区域,再入栈。要注意,每个区域的堆里初始都是1=(1+1)/2个数,假设两个要合并的区域总有A、B个数,则堆里总有(A+1)/2、(B+1)/2个数,若(A+1)/2+(B+1)/2>(A+B+1)/2,仅需把合并好的堆弹出顶端即可。

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