
最小生成树
幽殇默
他时若遂凌云志,敢笑黄巢不丈夫。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
1146. 新的开始【最小生成树 虚拟源点】
https://www.acwing.com/problem/content/1148/ #include<bits/stdc++.h> using namespace std; struct node{int a,b,c;}; bool cmp(node a,node b) {return a.c<b.c;} const int N=1e3+10; int a[N],p[N],n,c; vector<node>ve; int find(int x) { if(x!=.原创 2021-10-14 19:54:57 · 148 阅读 · 0 评论 -
1144. 连接格点【最小生成树】
https://www.acwing.com/problem/content/description/1146/ #include<bits/stdc++.h> using namespace std; const int N=1e6+10; int p[N],n,m; int x,y,xx,yy; struct node{int a,b,c;}; bool cmp(node a,node b) {return a.c<b.c;} vector<node>ve; int fi.原创 2021-10-14 16:27:02 · 193 阅读 · 0 评论 -
1143. 联络员【最小生成树】
https://www.acwing.com/problem/content/1145/ #include<bits/stdc++.h> using namespace std; const int N=1e5+10; struct node{int a,b,c;}; bool cmp(node a,node b) {return a.c<b.c;} vector<node>ve1,ve2; int p[N],n,m; int find(int x) { if(x!=.原创 2021-10-14 15:37:20 · 203 阅读 · 0 评论 -
1142. 繁忙的都市【最小生成树】
https://www.acwing.com/problem/content/1144/ #include<bits/stdc++.h> using namespace std; const int N=1e3+10; struct node{int a,b,c;}; bool cmp(node a,node b) {return a.c<b.c;} int p[N],n,m,cnt,ans; vector<node>ve; int find(int x) { if(.原创 2021-10-14 15:23:57 · 180 阅读 · 0 评论 -
P3366 【模板】最小生成树
https://www.luogu.com.cn/problem/P3366 #include<bits/stdc++.h> using namespace std; const int N=1e4+10; int p[N],n,m; struct node{int a,b,c;}; bool cmp(node a,node b){return a.c<b.c;} vector<node>ve; int find(int x) { if(x!=p[x]) p[x]=fin.原创 2021-10-14 15:13:51 · 133 阅读 · 0 评论 -
1141. 局域网【最小生成树】
https://www.acwing.com/problem/content/description/1143/ 求这个图的每个联通块内,求一颗最小生成树,相当于求原图的"最小生成深林" #include<bits/stdc++.h> using namespace std; const int N=210; int n,m,sum; int p[N]; struct node{int a,b,c;}; bool cmp(node a,node b) {return a.c<b.c;} .原创 2021-10-14 14:42:30 · 208 阅读 · 0 评论 -
AcWing 1140. 最短网络【最小生成树板子题】
https://www.acwing.com/problem/content/1142/ 克鲁斯卡尔算法 #include<bits/stdc++.h> using namespace std; const int N=110; int a[N][N],n,p[N]; struct node{int a,b,c;}; bool cmp(node a,node b) {return a.c<b.c;} vector<node>ve; int find(int x) { .原创 2021-10-14 13:47:57 · 144 阅读 · 0 评论