1114 Family Property

并查集

#include 
#include 
#include 
#include 
using namespace std;
struct Node{
	int id,fid,mid,k,num,area;
	int child[10];
}node[1005];
struct Ans{
	int people,id;
	double num,area;
	bool flag=false;
}ans[10000];
int visit[10000]={0};
int father[10000];
int find(int a){
	while(father[a]!=a){
		a=father[a];
	}
	return a;
}
void Union(int A,int B){
	int faA=find(A);
	int faB=find(B);
	if(faA>faB){
		father[faA]=faB;
	}else if(faAb.area;
	else 
		return a.id>n;
	for(int i=0;i<10000;i++){
		father[i]=i;
	}
	for(int i=0;i

你可能感兴趣的:(1114 Family Property)