打了一份并查集一份dfs的代码
#include<cstdio>
typedef long long ll;
const int N=1e3+10;
int set[N];
ll n,h,r;
struct node{
ll x,y,z;
}hole[N];//存点
void init()//初始化代表元全为自己
{
for(int i=0;i<=n+1;i++)
set[i]=i;
}
int findset(int x)//查找代表元
{
if(x==set[x])
return x;
else return set[x]=findset(set[x]);
}
void unionset(int x,int y)//并集
{
int fx=findset(x);
int fy