https://www.luogu.com.cn/problem/P2212
并查集建边,点边转换#include
#define int long long
using namespace std;
const int maxn=1e7+5;
struct node
{
int x,y,dis;
}e[maxn];
struct Edge
{
int u,v,dis;
}edge[maxn];
int n,c,f[maxn],cnt,ans,g;
void add(int from,int to,int dis)
{
edge[++cnt].u=from;
edge[cnt].v=to;
edge[cnt].dis=dis;
}
bool cmp(Edge e1,Edge e2)
{
return e1.dis
关注
打赏