题目: http://acm.hdu.edu.cn/showproblem.php?pid=1863 注意有可能出现无法生成树的情况. #include <iostream> #include <cstring> using namespace std; const int inf=0xffffff; int weight[105][105],n,m; int prime() { int sum=0; int pre[105]; int dis[105]; bool visit[1…
并查集+最小生成树 畅通工程 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 19824 Accepted Submission(s): 8449 Problem Description 省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可).经过调查评估,得到的统计…
FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 56784 Accepted Submission(s): 19009 Problem Description FatMouse prepared M pounds of cat food, ready to trade with the cats g…