摘要: 题意: 给你n个点,m条无向边,每条边都有长度d和花费p,给你起点s终点t,要求输出起点到终点的最短距离及其花费,如果最短距离有多条路线,则输出花费最少的。 阅读全文
posted @ 2018-08-03 20:58 Neord 阅读(195) 评论(0) 推荐(0)
摘要: #include #include #include using namespace std; int n, m, S, T; const int MAXN = 2010;//点数的最大值 const int MAXM = 1200010;//边数的最大值 const int INF = 0x3f3f3f3f; struct Edge { int to,next,cap,flow; }... 阅读全文
posted @ 2018-08-03 16:24 Neord 阅读(150) 评论(0) 推荐(0)
摘要: 参考: https://blog.csdn.net/txl199106/article/details/64441994 分析: 该算法是用bfs求出是否有路从s到t, 然后建立反向边(关于反向边), 最终求出答案, 复杂度(mn) 阅读全文
posted @ 2018-08-03 13:11 Neord 阅读(166) 评论(0) 推荐(0)