Title: http://dev.codevs.cn/problem/1183/
Analysis: This is very similar to the optimal rate spanning tree, which can be divided into two answers, except that the first is to determine whether there is a shortest path, and the other is to determine whether a tree is generated. Assume that ANS is to be determined, we can change the edge weight of each edge to s [I] [J]-ans * t [I] [J], then run the longest path. If d [N]> = 0, it indicates that this ANS is feasible. However, you must note that the right ring may appear during the longest possible path, so you can make up the following, whether or not the ring contains N, but they can all go through this ring several times, which makes the current d very big, so that when taking some negative side to N, the total d [N] is greater than or equal to 0, so when there is a right ring, we can think that this ANS is feasible.
[Codevs 1183] [muddy roads (Binary + spfa)