| ||||||||||
| 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 | |||||||||
wa 无数次。。。。。。。谁来救救我:(我的做法:
将堆转为一个序列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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator