随笔分类 -  最小生成树

【树上LCA】P1967 货车运输
摘要:1 #include<iostream> 2 #include<string> 3 #include<queue> 4 #include<stack> 5 #include<vector> 6 #include<map> 7 #include<cstdio> 8 #include<cstdlib> 阅读全文
posted @ 2019-10-16 10:31 thjkhdf12 阅读(94) 评论(0) 推荐(0)
【Kruskal】P3366 【模板】最小生成树
摘要:1 #include <iostream> 2 #include <algorithm> 3 using namespace std; 4 5 struct Node 6 { 7 int u, v, w; 8 }node[200005]; 9 10 int s[5005]; 11 int n, m; 阅读全文
posted @ 2019-10-09 13:50 thjkhdf12 阅读(109) 评论(0) 推荐(0)
【Kruskal】P1991 无线通讯网
摘要:1 #include<iostream> 2 #include<algorithm> 3 #include<cmath> 4 #include<iomanip> 5 using namespace std; 6 7 int fa[501]; 8 9 int find(int x) 10 { 11 i 阅读全文
posted @ 2019-10-09 13:36 thjkhdf12 阅读(112) 评论(0) 推荐(0)
【Kruskal】P2330 [SCOI2005]繁忙的都市
摘要:1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 5 int fa[301]; 6 7 int find(int x) 8 { 9 if (x == fa[x]) return x; 10 fa[x] = find 阅读全文
posted @ 2019-10-09 13:35 thjkhdf12 阅读(99) 评论(0) 推荐(0)
【Kruskal】P1546 最短网络 Agri-Net
摘要:1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 5 int fa[200010]; 6 int n; 7 int cnt; 8 9 struct Edge 10 { 11 int u, v, w; 12 bool 阅读全文
posted @ 2019-10-09 13:34 thjkhdf12 阅读(122) 评论(0) 推荐(0)