mst
WsMiracle
这个作者很懒,什么都没留下…
展开
-
POJ - 1679 The Unique MST. 求次小生成树
判断最小生成树是否唯一, 即求次小生成树, O(nm + mlogm) 还要判断一下图是否联通。#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <queue>using namespace std;struct node{ int u, v, w;}e[1000原创 2017-08-23 14:15:03 · 216 阅读 · 0 评论 -
ACM Contest and Blackout UVA - 10600
In order to prepare the “The First National ACM School Contest” (in 20??) the major of the city decided to provide all the schools with a reliable source of power. (The major is really afraid of blacko原创 2017-08-24 09:59:24 · 237 阅读 · 0 评论 -
最小树形图 Command Network POJ - 3164
朱刘算法模版#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <queue>#include <cmath>#include <vector>using namespace std;struct node{ int u, v, next; double w原创 2017-08-28 14:49:41 · 253 阅读 · 0 评论 -
不定根最小树形图 Ice_cream’s world II HDU - 2121
不定根就是加一个虚根(原本不存在的点) , 可以让这个虚根到每个点的距离大于原本所有点连接的道路花费之和sum , 然后计算出的结果减去sum,如果比sum还大就可以认为通过这个虚拟节点我们连过原图中两个点,即原图是不连通的,我们就可以认为不存在最小树形图。那么真正的根呢 , 在找最小入弧时,如果这条弧的起点是虚拟根,那么这条弧的终点就是要求的根,因为如果有多解的话,必然存在一个环,环上的顶点都可以原创 2017-08-28 19:45:25 · 512 阅读 · 0 评论 -
Organising the Organisation UVA - 10766
生成树计数, matrix-tree定理#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <queue>#include <cmath>#include <vector>using namespace std;int f[51][51];long double c[51]原创 2017-08-30 16:40:19 · 346 阅读 · 0 评论