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 fzk at 2007-04-03 10:15:33 on Problem 3214
In Reply To:wa 无数次。。。。。。。谁来救救我:( Posted by:273544537 at 2007-04-02 21:55:33
> 我的做法:
> 将堆转为一个序列s  (就是后序遍历)
> 例如:
>       1
>    2     3
>  4   5  6  7
> 
> 转为:  4   5  2   6   7   3   1
> 
> 然后定义p[i]=s[i]-i
> 然后求出p 的最长不下降序列的长度l
> 然后用 ans=n-l
> n为堆元素个数
> 
> 为什么会错呢?

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