最小树形图

struct node
{
    int now,nex,dis;
    node(int now,int nex,int dis):
        now(now),nex(nex),dis(dis) {}
    node(){}
} edge[40005];

int in[1005],id[1005],pre[1005],color[1005];

int mintreegraph(int n,int m,int root)
{
    int ans=0;
    while(1)
    {
        for(int i=1; i<=n; i++)
            in[i]=inf;
        for(int i=1; i<=m; i++)
        {
            int now=edge[i].now,nex=edge[i].nex;
            if(now!=nex && edge[i].dis

你可能感兴趣的:(最小树形图)