
【最短路】
Kuguotao
这个作者很懒,什么都没留下…
展开
-
POJ - 2387 (最短路 SPFA)
输入,n,m,n表示n条路径,m指m个地点 输入n条路径信息a,b,c(a,b指两个相连的地点,c指路径长度) SPFA 在形式上和广度(宽度)优先搜索非常类似,不同的是bfs中一个点出了队列就不可能重新进入队列,但是SPFA中一个点可能在出队列之后再次被放入队列,也就是一个点改进过其它的点之后,过了一段时间可能本身被改进(重新入队),于是再次用来改进其它的点,这样反复迭代下去 #i...原创 2019-03-23 19:40:11 · 286 阅读 · 0 评论 -
个人赛(D - 防ak HDU - 1535 )最短路(SPFA)
In the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fact. They want to propagate theater and, most of all, Antique Comedies. They ...原创 2019-03-26 23:23:05 · 221 阅读 · 0 评论 -
Transport Goods ZOJ - 1655 (最短路Dijkstra变形)
The HERO country is attacked by other country. The intruder is attacking the capital so other cities must send supports to the capital. There are some roads between the cities and the goods must be tr...原创 2019-04-05 21:07:12 · 441 阅读 · 0 评论 -
hdu-6582 Path(最短路+dinic)
链接;http://acm.hdu.edu.cn/showproblem.php?pid=6582 题意:给你一个图,要求你减去一些边使得1至n的最短路径变长。并且使得花费最小,删边花费为其长度。 思路:先求出最短路,将所有的最短路的边新建一个图,跑一个最大流就可以了。 #include <cstdio> #include <queue> #include <...原创 2019-08-08 10:27:52 · 330 阅读 · 1 评论 -
hdu-6705 path (全图第k短路 优先队列)
hdu-6705 path 题意:给你有向图,求第k短路的路径的长度(所有路径不限制使用次数) 思路:从多校群里搞到的。 #include <cstdio> #include <queue> #include <cstring> #include <iostream> #include <algorithm> #include &...原创 2019-08-24 14:32:21 · 622 阅读 · 0 评论 -
hdu-6714 最短路 2(dijkstra+堆优化)
hdu-6714 小 A 是社团里的工具人,有一天他的朋友给了他一个n个点,m条边的正权连通无向图,要他计算所有点两两之间的最短路。 作为一个工具人,小 A 熟练掌握着 floyd 算法,设w[i][j]为原图中(i,j)之间的权值最小的边的权值,若没有边则w[i][j]=无穷大。特别地,若i=j,则w[i][j]=0。 Floyd 的 C++ 实现如下: ```c++ fo...原创 2019-09-04 19:17:59 · 331 阅读 · 0 评论