并查集
#include<bits/stdc++.h>
using namespace std;
int f[10010];
int pf[10010];
int n,m,c,d,t;
int find(int x)//查找祖宗
{
return f[x] == x ? f[x] : f[x]=find(f[x]);
}
void join(int x,int y)//合并集合,y合并到x中
{
f[find(y)]=find(x);
}
bool cmp(int x,int y)//判断两个点是否
原创
2021-08-24 18:02:25 ·
154 阅读 ·
0 评论