Advertisement

1393:联络员(liaison)

阅读量:

1393:联络员(liaison)
时间限制: 1000 ms 内存限制: 65536 KB
【题目描述

复制代码
 #include <iostream>

    
 #include <stdio.h>
    
 #include <algorithm>
    
 using namespace std;
    
 const int maxn=2010;  // 最大点数
    
 const int maxm=20010; // 最大边数
    
 struct point{
    
     int x,y,c;  // 无向边(x,y),权值为c
    
 }a[maxm];       // 存储询问的边
    
 bool cmp(const point &a,const point &b){
    
     return a.c<b.c;
    
 }
    
 int n,m,ans,k;    // n为点数,m为边数(包括询问边),ans为最小生成树的边权和,k为询问边的数量。
    
 int f[maxn];      // 并查集,用于判断两个节点是否在同一集合
    
 int find(int x){   // 查找x所属集合的代表元
    
     if(f[x]==x) return x;
    

全部评论 (0)

还没有任何评论哟~