MST Kruskal普遍实现

#include
#include
#include
#include
using namespace std;

#define MAXN 10000
#define MAXM 1000000
#define INF 1<<30
//int first[MAXN];
struct edge { int u, v, w; }a[MAXM];
bool operator<(const edge& a, const edge& b) { return a.w>n>>m)
	{
		for(int i=0; i>a[i].u>>a[i].v>>a[i].w;
		return 1;
	}
	return 0;
}
int main()
{
	while(read_graph())
	{
		exist = 0;
		int ans = kruskal();
		cout<<(exist? ans: -1)<


你可能感兴趣的:(图论,ACM)