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 crackerwang at 2007-08-05 23:18:06 on Problem 3320
In Reply To:解题报告里面说用堆做,有没有谁能解释一下? Posted by:cn_chen at 2007-08-05 23:03:16
heap[]存放的是数字出最后出现的位置.然后根据这个建立一个最小堆.
当输入的数据前面没有出现过就把他直接加在堆尾.
如果出现过需要找到这个数字所在的堆的位置./*所以这里还要一个数组*/
更新heap[]从新调整.步长就是当前位置减去heap[1]+`1;

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