最小生成树
liluoyu_1016
这个作者很懒,什么都没留下…
展开
-
HDU 1102 Constructing Roads 最小生成树
There are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to each other. We say two village A and B are connected, if and only if t原创 2017-09-16 10:10:58 · 191 阅读 · 0 评论 -
HDU 1875 畅通工程再续 克鲁斯卡尔
相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1000米。当然,为了节省资金,只要求实现任意2个小原创 2017-09-16 14:45:17 · 171 阅读 · 0 评论 -
POJ-1251 Jungle Roads 最小生成树(prim算法)
The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages some years ago. But the jungle overtakes roads relentlessly, so原创 2017-09-10 08:58:59 · 273 阅读 · 0 评论 -
poj 2031 Building a Space Station (kruskal算法)
You are a member of the space station engineering team, and are assigned a task in the construction process of the station. You are expected to write a computer program to complete the task. The sp原创 2017-09-12 21:45:20 · 274 阅读 · 0 评论 -
次小。最小生成树
#include #include #include using namespace std; const int M =500; const int inf=0x3f3f3f3f; int t,n,m; int vis[M]; int low[M]; int pre[M]; int dis[M][M],cost[M][M]; int used[M][M]; int prim(int st,int原创 2017-11-14 20:16:29 · 174 阅读 · 0 评论