问题:
sample Input:
4
5
1
1 2 3
1 3 4
1 4 5
2 3 8
3 4 2
sample output:
4
样例说明:
题解:
1.这个题其实也是krusal算法,直不过上一题我们要求的是最小生成树的权重,这一题要求的是最小生成树的最大边权,只不过是在树的生成过程中记录的是边权的最大值。
完整代码:
#include <iostream>
#include<stdio.h>
#include<stdlib.h>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */