Open utterances-bot opened 1 year ago
ac ai cần
using namespace std;
int n,m;
struct Edge
{
int u,v;
double w;
};
Edge e[1000001];
int father [1001];
int sz [1000001];
int check[1001][1001];
int sz_e=0;
int x[10001];
int y[10001];
int cmp(Edge a,Edge b)
{
return a.w<b.w;
}
int Find(int u)
{
if (father[u]==u) return u;
return father[u]=Find(father[u]);
}
void Union(int a,int b)
{
if(sz[a]<sz[b])swap(a,b);
father[b]=a;
sz[a]+=sz[b];
}
void kruskal()
{
vector
sort(e+1,e+sz_e+1,cmp);
//for(int i=1;i<=n;i++)cout<<"("<<e[i].u<<","<<e[i].v<<")="<<e[i].w<<endl;
kruskal();
} //code by thần đồng k12
Khôi phục nông trại - Luyện Code Online
https://oj.luyencode.net/problem/ROADS