题目 题意: 略。经典排序题。 思路: 用了超笨的方法,建图dfs用并查集合并,最后排序输出。 时间复杂度: O(能过) 代码:
#include
using namespace std;
const int N = 1e5+10;
const int M = 9999;
int n,m,k,T;
struct node{
int id = 77777; //编号
int num = 1; //人数
double tot; //房产数
double av; //房产面积
bool operator rhs.av;
return id >z>>num;
vis[x]=1;
if(y!=-1) va[x].push_back(y),va[y].push_back(x),vis[y]=1;
if(z!=-1) va[x].push_back(z),va[z].push_back(x),vis[z]=1;
while(num--)
{
int t; cin>>t;
vis[t] = 1;
va[x].push_back(t);
va[t].push_back(x);
}
cin>>a[x].tot>>a[x].av;
a[x].id = x;
}
for(int i=0;i
关注
打赏