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 jlnu123 at 2009-04-10 19:45:11 on Problem 1511
题目大意:一个城市的巴士路线很古怪,只开单向,而且只有起点站和终点站,例如路线 1->2 就只从1号站开到2号站,不会载人往回开。在这样的基础上,p-1个人,每天要从1号站去到2-p号站,每站去一个人,然后晚上回到1号站。要求这样的车费最小。典型的单源最短路径。

思路:数据量很大,节点数 p <= 1000000 。所以不能用邻接矩阵来实现,必须要用邻接表,而且 dijkstra 算法要用最小堆来优化时间。去时直接用 dijkstra 单源最短路径,回来时构造邻接表的逆置然后再单元最短路径。

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