#include<stdio.h> #include<string.h> using namespace std; int map[505][505]; int v, e; int prime() { bool vis[505]; int dist[505]; int i,j,sum=0; for(i=1;i<=v;i++) { vis[i]=0; //先假设编号为1的点加入MST dist[i]=map[1][i]; } vis[1]=1; for(i=1;i<v;i…
Networking Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 7321 Accepted: 3977 Description You are assigned to design network connections between certain points in a wide area. You are given a set of points in the area, and a set of po…
Truck History Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 21518 Accepted: 8367 Description Advanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable delivery, other for furniture, or for brick…
Building a Space Station Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 5699 Accepted: 2855 Description You are a member of the space station engineering team, and are assigned a task in the construction process of the station. You ar…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1233 可以用Kruskal来做,不过当图的边比较稠密的时候用prime会更快一些. AC代码:296MS #include <iostream> #include <cstring> #include <cstdio> using namespace std; const int inf=0xffffff; int dis[105],sum,n; int weight[105]…
题目: 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…
题目: Out of Hay Time Limit: 1000MS Memory Limit: 65536K Total Submissions: Accepted: Description The cows have run <= N <= ,) farms (numbered ..N); Bessie starts at Farm . She'll traverse some or all of the M (1 <= M <= 10,000) two-way roads wh…
还是畅通工程 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 45926 Accepted Submission(s): 20922 Problem Description 某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离.省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能…
链接: http://poj.org/problem?id=2031 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=22013#problem/A Building a Space Station Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 3578 Accepted: 1830 Description You are a member of the s…
还是畅通project Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 26860 Accepted Submission(s): 11985 Problem Description 某省调查乡村交通状况,得到的统计表中列出了随意两村庄间的距离.省政府"畅通project"的目标是使全省不论什么两个村庄间都能够实现公路交…