![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
最短路
q435201823
11
展开
-
迪杰斯特拉 + 堆优化 模板
堆优化用优先队列实现。 #include <iostream> #include <cstdio> #include <queue> #include <vector> #include<cstring> using namespace std; #define MAXN 205 #define INF 0x3f3f3f...原创 2018-08-07 20:32:47 · 273 阅读 · 0 评论 -
HDU - 1599 - find the mincost route(floyd判断最小环 模板)
杭州有N个景区,景区之间有一些双向的路来连接,现在8600想找一条旅游路线,这个路线从A点出发并且最后回到A点,假设经过的路线为V1,V2,….VK,V1,那么必须满足K>2,就是说至除了出发点以外至少要经过2个其他不同的景区,而且不能重复经过同一个景区。现在8600需要你帮他找一条这样的路线,并且花费越少越好。 Input 第一行是2个整数N和M(N <= 100, M <...原创 2018-08-08 15:44:03 · 133 阅读 · 0 评论 -
简化SPFA模板
用邻接表存图,在代码“注意1”处就不用遍历n个边,更快,所以这个模板算是个简化的模板 #include<cstdio> #include<queue> #include<cstring> using namespace std; typedef long long ll; #define maxn 205 #define INF 0x3f3f3f3f int ...原创 2018-08-08 20:41:35 · 112 阅读 · 0 评论