/**
[MST]hdu 2122 Ice_cream’s world III
先一边DFS看图是否联通,然后裸的MST
*/
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
using namespace std;
#define N 1024
#define M 10000
vector<int> vec[N];
int f[N],r[N];
struct Edge
{
int u,v,c;
void input()
{
scanf("%d%d%d",&u,&v,&c);
vec[u].push_back(v);
vec[v].push_back(u);
}
}edge[M];
int getF(int x)
{
return x == f[x] ? x : getF(f[x]);
}
void unionSet(int x,int y)
{
if(r[x] > r[y])
f[y] = x;
else
{
f[x] = y;
if(r[x] == r[y])
r[y] ++;
}
}
int vis[N];
int n,m,cnt;
void dfs(int u)
{
vis[u] = 1;
++c
[MST]hdu 2122 Ice_cream’s world III
最新推荐文章于 2020-02-27 22:54:55 发布