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 braveTester at 2012-03-27 00:09:26 on Problem 1273 and last updated at 2012-03-27 00:11:11
In Reply To:求解 GAP 优化的灵异问题 Posted by:braveTester at 2012-03-21 18:23:03
果断决定自问自答...
GAP 优化没有问题, 问题出在 D 数组, 即距离数组的初始化上.
应该初始化为最大值, 并且 GAP 统计数组要开的足够大, 防止下标越界访问到{本程序的其他变量}而导致没有报错, 却 WA.
初始化的反例数据:
9 7
1 2 10
2 4 5
2 3 2
2 5 6
3 4 5
5 3 5
3 6 4
5 6 3
6 7 10

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