
Kruscal
Giggle1929
这个作者很懒,什么都没留下…
展开
-
JSK-布设光钎-Kruscal最小生成树-并查集-图的连通性
题目链接 (舍友走了四个,还剩我和老王) 水题,AC如下 #include<bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const int maxn = 105; int n, ans, fa[maxn], cnt; struct edge{ int u, v, w; edge(int _u,...原创 2019-07-12 21:51:58 · 115 阅读 · 0 评论 -
计蒜客-连线问题-Krucal-并查集
题目链接 无坑,AC代码 #include<bits/stdc++.h> using namespace std; const int maxn = 105; const int inf = 0x3f3f3f3f; struct point{ int x, y; point(){ } point(int xx, int yy){ x = xx; y = yy; } ...原创 2019-07-12 22:23:45 · 129 阅读 · 0 评论 -
计蒜客-穿越雷区-Kruscal最小生成树
题目链接 水题做多了有害身体健康? AC代码 #include<bits/stdc++.h> using namespace std; const int maxn = 30005; const int maxm = 50005; int n, m, fa[maxn], ans, cnt; struct edge{ int u, v, w; edge(int uu, int v...原创 2019-07-12 22:55:07 · 137 阅读 · 0 评论 -
计蒜客-高速公路-Kruscal-最小生成树
题目链接 由于:最小生成树中的最大边一定是所有生成树中最小的 故:枚举每个边, 对于每个边,以其为生成树的最小边Kruscal做生成树,求出该生成树的极差并更新 AC代码 #include<bits/stdc++.h> using namespace std; const int maxn = 105; const int maxm = 5000; int n, m, fa[max...原创 2019-07-14 12:45:01 · 704 阅读 · 0 评论