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 2465806616 at 2018-07-23 10:48:48 on Problem 1062
In Reply To:找了一天错误,最后发现自己用错了迪杰斯特拉算法的核心(内含测试数据) Posted by:2465806616 at 2018-07-23 10:34:29
 4 4
 50000 4 2
 2 10
 3 10
 1000 4 1
 4 3
 100 4 1
 4 10
 10 4 0
 
 23
 
 本题用迪杰斯特拉算法找的应该是一条最短路的,每次都是通过边的值来更新当前的dis数组(到每个点的最短距离)(不能加上当前点的基础价格来更新(因为我们可以通过交易其他的物品来减少当前物品的花费,所以如果你直接加上当前点的基础价格就不能保证每次找的都是当前最短的的那条路的终点))

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