Kruskal_判断最小生成树是否唯一

http://poj.org/problem?id=1679

#include
#include
#include
#include
using namespace std;
const int N=10000+10;
int father[N+N];
int grade[N+N];
int component;
struct Edge
{
    int from,to,w;
    bool operator <(const Edge& that) const
    {
        return wgrade[fb])
    {
        father[fb]=fa;
        grade[fa]+=grade[fb];
    }
    else
    {
        father[fa]=fb;
        grade[fb]+=grade[fa];
    }
    component--;
    return 1;

}
int main()
{
    int t,n,m,a,b,c;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d%d",&n,&m);
        component=n;
        vector edge;
        for(int i=1;i<=n;i++)
        {
            father[i]=i;
            grade[i]=1;
        }
        for(int i=0;i::iterator it=edge.begin();it!=edge.end();it++)
        {
            for(int i=1;i<=n;i++)
            {
                father[i]=i;
                grade[i]=1;
            }
            component=n;
            int sum=0;
            for(int i=0;i

你可能感兴趣的:(Kruskal_判断最小生成树是否唯一)