题目
给定一个 n 个点 m 条边的无向图,图中可能存在重边和自环,边权可能为负数。
求最小生成树的树边权重之和,如果最小生成树不存在则输出 impossible。
给定一张边带权的无向图 G(V,E),其中 V 表示图中点的集合,E…
最短网络
题目http://ybt.ssoier.cn:8088/problem_show.php?pid1350
#include<bits/stdc.h>
using namespace std;
const int N110;
int w[N][N];
bool st[N];
int dist[N];
int n,res0;
void prim()
{memset(dist,0x3f,sizeof dist);dist[1]0;//初始化第一个点到自己…