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 lvcheng at 2010-04-09 18:57:24 on Problem 1062
我犯了一个巨白痴的错误,在memset时把bool数组写成sizeof(int)*len,应该是sizeof(bool)*len.最后导致溢出,不过按说溢出应该自动截断的,但一交就错。希望对各位提个醒,不要犯同样的错误。
思路,添加超级源S。
S-->i,权值P[i].| 1<=i<=N
T-->i,权值V.| 1<=i<=N; T,V为题中所述
求出S到1的最短路即可。
等级限制可以通过枚举最高等级,然后对于所有的点判断是否满足小于等于最高等级,且与其差小于等于M,做N次Dijkstra即可。复杂度O(N^3)。

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