我个人比较喜欢Kruskal算法,所以就把这个方法写了一下,但过不了洛谷,70分. 思路是先全读入,再排序,一条一条加边.运用并查集. #include<iostream> #include<cstdio> #include<algorithm> using namespace std; struct s{ int h; int t; int w; }; ]; bool cmp(s a,s b) { return a.w < b.w; } int find(int…
Travel Time Limit: 1500/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 1852 Accepted Submission(s): 641 Problem Description Jack likes to travel around the world, but he doesn't like to wait. Now, he is t…