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

这题我的算法是将sticks按长宽的和降序排序,再一组组覆盖,但WA,好心的大牛帮我看一下好吗?

Posted by Basara at 2006-08-10 22:30:53 on Problem 1065
算法思想:比如第一组数据中元素排序后是:(4,9)(3,5)(5,2)(1,4)(2,1)
先将最大的(4,9)取出放入分组的数组queue里的第一个位置, 再遍历原数组,若该木棍的长和宽可以满足都小
于或等于queue数组中的某个木棍,则用它的值覆盖掉那个元素,如果没找到,则在queue 数组中新开辟一个元素
存这个木棍的值。 这样最后queue数组中被开辟了多少个元素,则需要耗时多少分钟。

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