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

调试了2天。。终于知道错在哪里了

Posted by leonardWang at 2010-03-13 13:27:02 on Problem 2908
这道和平常的BFS有点区别
千万要在priority_queue pop后才做是否与目标状态的判断(这样才能保证是最小的耗费 因为后面已经都比它大了,再做其他操作只会更大 所以不可能有比现在还小的)  而不是在进行位操作好之后判断(此时即使与目标状态相等 也不一定是最小耗费)
平时的BFS是按层的 所以没问题


给个test case
2
4 3 1
FFFF 10
FF00 1
00FF 1
0000 1111

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