| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
原来是初始化的问题...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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator