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

没给Q的大小,所以我做N次单元最短路,存一个二元矩阵,O(n*ke)

Posted by cl__xy at 2012-07-18 16:10:43 on Problem 4046
在做是,没给Q的大小,所以我做N次单元最短路,存一个二元矩阵。做spfa前,我先按照每个点的权值进行排序,然后显然最大权值的点可以一次SPFA得到即(dis[max][i]=dis1[max][i]+val[amx]),而对于其他点,spfa时,遇到比自己权值大的点,我只如队列一次保证可以通过这个点更新比自己小的点,而比自己小的点则按照正常方法,spfa,为什么总是不过,求大神安慰!!

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