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 fanhqme at 2009-07-15 18:10:35 on Problem 3038 and last updated at 2009-07-15 18:10:58
开始以为是个网络流或lp之类的。看数据规模总是有用的...貌似1000ms内什么算法也推不动50000*k多个点的流。

想象自己是一个黑一日游的司机:

1.如果有乘客要上车,那么就让他上,收钱!
2.如果超载了,把距目的地最远的几个乘客踢下去,退钱。
3.行驶到下一站

C比较小,用数组维护就可以了!(用heap当然更好,不过介于我的大脑做题时比较晕,不敢写堆了)

题目让往返两程都计算,比较坑人。代码需要注意的细节比较多,例如排序的次序。像大脑晕到我这种地步的人很容易wa。


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