随笔分类 -  图论——最短次短K短路

摘要:分治+最短路,很套路的 cpp include include include include include using namespace std; int n, m, ans[100005], px[20005], py[20005], uu, hea[20005], cnt, q, din; 阅读全文
posted @ 2018-05-17 13:50 poorpool 阅读(125) 评论(0) 推荐(0)
摘要:裸dinic就跑过去了,哪用得着平面图最小割=最短路…… cpp include include include include using namespace std; int n, m, w, ss, tt, hea[1000005], cnt, lev[1000005], cur[100000 阅读全文
posted @ 2018-04-12 09:52 poorpool 阅读(153) 评论(0) 推荐(0)
摘要:无向图最小环 cpp include include include include using namespace std; typedef long long ll; int n, m, uu, vv, ww, a[105][105], b[105][105], pos[105][105], a 阅读全文
posted @ 2018-03-19 16:07 poorpool 阅读(104) 评论(0) 推荐(0)
摘要:两遍 spfa 然后建立分层图拓扑排序 dp 一下。 写得很差劲。效率很低。 时间复杂度 $\mathrm{O}(Tnk)$。 参见 "这里" 秒懂。 阅读全文
posted @ 2018-02-15 19:46 poorpool 阅读(116) 评论(0) 推荐(0)
摘要:模板题 cpp include include include include using namespace std; int n, m, hea[5005], cnt, uu, vv, ans; double e, ww, dis[5005]; const double eps=1e 7; bo 阅读全文
posted @ 2018-01-20 11:02 poorpool 阅读(204) 评论(0) 推荐(0)
摘要:状压最短路 cpp include include include include using namespace std; struct Node{ int bi1, bi2, fi1, fi2; }nd[105]; int n, m, ww[105], cnt, dis[1050005]; bo 阅读全文
posted @ 2017-12-26 10:02 poorpool 阅读(107) 评论(0) 推荐(0)
摘要:K短路裸题。 阅读全文
posted @ 2017-12-03 20:28 poorpool 阅读(163) 评论(0) 推荐(0)
摘要:注意:如果是这么个写法,堆数组要开成n+m的。 为什么呢?设想一下从1到2有m条长度递减的路,这岂不是要入队m次…… cpp include include include include using namespace std; struct Edge{ int too, nxt, val; }e 阅读全文
posted @ 2017-12-02 11:37 poorpool 阅读(180) 评论(0) 推荐(0)
摘要:```cpp include include include include using namespace std; int n, m, s, dis[10005], din, uu, vv, ww, hea[10005], cnt; bool vis[10005]; struct Node{ i 阅读全文
posted @ 2017-12-01 21:49 poorpool 阅读(191) 评论(0) 推荐(0)