
最小生成树
文章平均质量分 75
sortmin
这个作者很懒,什么都没留下…
展开
-
最小生成树 - H - Highways
HighwaysDescriptionThe island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has a very poor system of public highways. The Flatopian government is aware of this problem and has原创 2017-08-24 18:13:15 · 232 阅读 · 0 评论 -
POJ2395 Out of Hay
Out of HayTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 18697 Accepted: 7393DescriptionThe cows have run out of hay, a horrible event that must be remedied immediately. Bessie intends to v...原创 2018-03-15 00:57:51 · 188 阅读 · 0 评论 -
AOJ 2224 Save your cat
Save your catsNicholas Y. Alford was a cat lover. He had a garden in a village and kept many cats in his garden. The cats were s...原创 2018-03-15 00:34:42 · 209 阅读 · 0 评论 -
POJ1258 Agri-Net
Agri-NetTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 65154 Accepted: 26945DescriptionFarmer John has been elected mayor of his town! One of his campaign promises was to bring internet con...原创 2018-03-14 23:17:38 · 216 阅读 · 0 评论 -
HDU - 1233 还是畅通工程
HDU - 1233 还是畅通工程 某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。Input测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( < 100 );随后的N(N-原创 2017-10-06 01:58:48 · 360 阅读 · 0 评论 -
HDU - 1102 - Constructing Roads
Constructing RoadsHDU - 1102 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原创 2017-10-06 00:56:04 · 195 阅读 · 0 评论 -
最小生成树 - D - Constructing Roads
题意:给定N个点与各边的权值,已知一定的边已连接,求连接剩下的点的最小权值和。题解:将已联系的边的权值改为0即可,prim算法。AC代码:#includeusing namespace std;const int inf = 1e9;int a[105][105];int n,m,sum;int vis[105];int length[111];void prim(){原创 2017-08-24 14:52:47 · 213 阅读 · 0 评论 -
最小生成树 - E - QS Network
题意:N个结点的最小生成树,点和边都有权值;求最小生成树。题解:裸prim模板,把实际边权值计算为边权值+两点的点权值即可。AC代码:#includeusing namespace std;int t,m,n,sum;const int maxn = 1005;const int inf = 0x3f3f3f3f;int a[maxn][maxn];int vis[maxn];原创 2017-08-24 14:48:08 · 252 阅读 · 0 评论 -
最小生成树 - B - Networking
题意:给定一定的点和路径(路径可重复),找最小生成树。题解:模板题 需要注意输入边时直接记录多条边的最小值。AC代码:#includeusing namespace std;const int inf = 1e9;int a[55][55];int n,m,sum;int vis[55];int length[55];void prim(){ for(int i原创 2017-08-24 00:06:55 · 183 阅读 · 0 评论 -
最小生成树 - A - Jungle Roads
题意:给定A-Z之间一定的点 各点的距离给出。求其最小生成树题解:水题,prim模板解决 把A-Z的字符都减去‘A’即可AC代码:#includeusing namespace std;const int inf = 1e9;int a[30][30];int n,m,sum;char x;int vis[30];int length[30];void prim()原创 2017-08-23 23:51:19 · 236 阅读 · 0 评论 -
专题六-最小生成树
马上大二开学了 还有很多没学会的 今天开始学习最小生成树,从网上看了很多资料,这里总结一下。第一种:prim算法(普里姆算法)普里姆算法(Prim算法),图论中的一种算法,可在加权连通图里搜索最小生成树。意即由此算法搜索到的边子集所构成的树中,不但包括了连通图里的所有顶点,且其所有边的权值之和亦为最小。该算法于1930年由捷克数学家沃伊捷赫·亚尔尼克发现;并在1957年由原创 2017-08-23 21:41:47 · 232 阅读 · 0 评论 -
最小生成树 - K - The Unique MST (次小生成树)
K - The Unique MST Given a connected undirected graph, tell if its minimum spanning tree is unique.Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A span原创 2017-08-25 20:53:35 · 440 阅读 · 0 评论 -
最小生成树 - F - Truck History
F - Truck HistoryAdvanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable delivery, other for furniture, or for bricks. The company has its own co原创 2017-08-25 13:22:13 · 303 阅读 · 0 评论 -
最小生成树 - L - 还是畅通工程
L - 还是畅通工程 某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。Input测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( < 100 );随后的N(N-1)/2行对应村庄原创 2017-08-25 00:09:39 · 193 阅读 · 0 评论 -
最小生成树 - N - 畅通工程再续
N - 畅通工程再续 相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1原创 2017-08-24 23:58:25 · 570 阅读 · 0 评论 -
最小生成树 - C - Building a Space Station
C - Building a Space Station 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 compu原创 2017-08-24 21:38:28 · 211 阅读 · 0 评论 -
最小生成树 - G - Arctic Network
G - Arctic NetworkThe Department of National Defence (DND) wishes to connect several northern outposts by a wireless network. Two different communication technologies are to be used in e原创 2017-08-24 20:17:19 · 235 阅读 · 0 评论 -
最小生成树 - I - Agri-Net
I - Agri-Net Farmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He needs your help, of course.Farmer John原创 2017-08-24 19:38:08 · 232 阅读 · 0 评论 -
Ural 1416 Confidential(次小生成树)
题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1416题意:求最小生成树和次小生成树,没有输出-1题解:次小生成树的其中一种求法是标记每一个点互相连接的最大边,标记最小生成树都用了那些边,然后遍历那些没用到的边,多链接一条边后去掉其中最大的一条边,找其中的最小值。AC代码:#include <iostream&g...原创 2018-07-22 23:07:16 · 293 阅读 · 0 评论