众所周知,SPFA(Shortest Path Fastest Algorithm)并不是最快的算法(虽然本题是SPFA)。或许试试Floyd剪枝?
by Kawaii_Natsume_Iroha @ 2023-07-07 16:49:26
@[douweiqi](/user/540956) 为啥我的SPFA最慢才125ms?
https://www.luogu.com.cn/record/115654286
by toolong114514 @ 2023-07-15 13:52:45
@[douweiqi](/user/540956) 邻接矩阵存图读取时常数大一些,或许你可以试试用链式前向星存图?
by toolong114514 @ 2023-07-15 13:54:47
@[douweiqi](/user/540956) 为啥我 $spfa$ 一遍过
by yuhaoyang09 @ 2023-11-03 21:50:08
@[douweiqi](/user/540956) $spfa$ 可以过,用 $vector$ 来存,不然会访问很多没用的节点
by yuhaoyang09 @ 2023-11-03 21:53:55