Lang:G++
Edit12345678910111213141516171819202122232425262728293031/****************************************\* Author : hzoi_ztx* Title : hiho一下 第二十六周 题目1 : 最小生成树一·Prim算法* ALG : 克鲁斯卡尔* CMT :* Time :\****************************************/#include <cstdio>int CH , NEG ;inline void read(int& ret) {ret = NEG = 0 ; while (CH=getchar() , CH<'!') ;if (CH == '-') NEG = true , CH = getchar() ;while (ret = ret*10+CH-'0' , CH=getchar() , CH>'!') ;if (NEG) ret = -ret ;}#include <algorithm>#define maxn 1010LL#define maxe 1000010LLstruct Edge { int u , v , w ; } e[maxe] ;int tot ;inline bool CmpW(const Edge& a , const Edge& b) { return a.w < b.w ; }int n , i , j , k , ans ;int par[maxn] = {0} ;inline int GetAnc(int u) { return par[u] ? par[u] = GetAnc(par[u]) : u ; }