![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
最短路问题
长歌丶采薇
这个作者很懒,什么都没留下…
展开
-
POJ 2387(最短路问题——Floyd Dijkstra SPFA算法)
POJ 2387-Til the Cows Come HomeBessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her bea...原创 2018-10-27 19:08:05 · 826 阅读 · 0 评论 -
最短路 Bellman-ford算法
最短路 Bellman-ford算法可以用来解决带负值的最短路,并且可以用来判断负环时间复杂度o(m*n) (m是边数,n是点数)具体步骤:用 u[] v[] w[]来存一条边 松弛的时候每次用 u[i]-v[i]这条边来松弛 初始点到 v[i]这条边。核心代码如下: for(int i=1;i<=n-1;i++)///松弛次数 { for(int j=1;j<=...原创 2018-10-27 22:23:32 · 170 阅读 · 0 评论 -
POJ-3255-Roadblocks(次短路)
POJ-3255-Roadblocks(次短路)Bessie has moved to a small farm and sometimes enjoys returning to visit one of her best friends. She does not want to get to her old home too quickly, because she likes the s...原创 2018-12-19 23:57:21 · 156 阅读 · 0 评论 -
HDU - 2586 - How far away ? (最短路)
HDU - 2586 - How far away ? (最短路)There are n houses in the village and some bidirectional roads connecting them. Every day peole always like to ask like this “How far is it if I want to go from house...原创 2018-12-20 00:16:23 · 211 阅读 · 0 评论 -
ZOJ - 3946 (Dijkstra的变形)
ZOJ - 3946(Dijkstra的变形)Edward, the emperor of the Marjar Empire, wants to build some bidirectional highways so that he can reach other cities from the capital as fast as possible. Thus, he proposed t...原创 2019-04-12 18:17:50 · 100 阅读 · 0 评论 -
HDU - 5889 Barricade(最短路上跑网络流)
HDU - 5889 Barricade(最短路上跑网络流)The empire is under attack again. The general of empire is planning to defend his castle. The land can be seen as N towns and M roads, and each road has the same length...原创 2019-07-24 17:37:28 · 112 阅读 · 0 评论 -
free牛客暑假多校训练第四场 J(分层图求最短路板子)
题目链接:https://ac.nowcoder.com/acm/contest/884/J题目大意:给你一个n个点m条边的图。允许一开始条边让其边权变为0,问最短路长度。解题思路:分层图求最短路板子AC代码:#include <bits/stdc++.h>#define ll long longusing namespace std;const int maxn ...原创 2019-07-27 18:29:53 · 110 阅读 · 0 评论