
----生成树
文章平均质量分 83
_Occult_
物語が始まった
展开
-
HDU 5697 刷题计划
Problem Description大赛将至,摆在你面前的是n道题目,第 i(1≤i≤n) 道题目能提升 ai 点智力值,代码量为 bi KB,无聊值为 ci ,求至少提升m点智力值的情况下,所做题目代码量之和∗无聊值之和最小为多少。样例解释:选择第1、3、4道题 Input多组测试数据第一行两个整数n,m(0n≤400)接下来n行原创 2016-05-25 13:47:03 · 1445 阅读 · 0 评论 -
ZOJ 3204 Connect them
DescriptionYou have n computers numbered from 1 to n and you want to connect them to make a small local area network (LAN). All connections are two-way (that is connecting computers i and j is the原创 2015-02-25 00:02:24 · 577 阅读 · 0 评论 -
ZOJ 2966 Build The Electric System
In last winter, there was a big snow storm in South China. The electric system was damaged seriously. Lots of power lines were broken and lots of villages lost contact with the main power grid. The go原创 2017-02-17 21:21:44 · 316 阅读 · 0 评论 -
UVA 10600 ACM Contest and Blackout
求最小和次小生成树的权值和,先求出最小生成树,然后枚举剩下的边,判断如果用这条作为替代得到的生成树里,最小的那个是次小。因为点数很少,可以直接暴力的求出全图所有点之间的最大边。#include #include #include #include #include using namespace std;#define ms(x,y) memset(x,y,sizeo原创 2016-12-15 14:56:01 · 217 阅读 · 0 评论 -
POJ 1679 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 spanning tree of G is a subgraph原创 2016-12-14 11:23:48 · 270 阅读 · 0 评论 -
POJ 2728 Desert King
DescriptionDavid the Great has just become the king of a desert country. To win the respect of his people, he decided to build channels all over his country to bring water to every village. Villag原创 2016-11-27 16:43:24 · 254 阅读 · 0 评论 -
UVA 11354 Bond
最小生成树+树链剖分+rmq#include#include#include#include#includeusing namespace std;#define ms(x,y) memset(x,y,sizeof(x))#define rep(i,j,k) for(int i=j;i<=k;i++)#define loop(i,j,k) for (int i=j;i!=-1;原创 2016-12-07 11:55:53 · 222 阅读 · 0 评论 -
UVA 1395 Slim Span
DescriptionGiven an undirected weighted graph G, you should find one of spanning trees specified as follows.The graph G is an ordered pair (V, E), where V is a set of vertices {v1, v2, …, vn} an原创 2016-12-06 13:27:09 · 311 阅读 · 0 评论 -
HDU 2121 Ice_cream’s world II
DescriptionAfter awarded lands to ACMers, the queen want to choose a city be her capital. This is an important event in ice_cream world, and it also a very difficult problem, because the world hav原创 2016-12-03 20:19:42 · 280 阅读 · 0 评论 -
PAT (Top Level) Practise 1013 Image Segmentation (35)
Image segmentation is usually formulated as a graph partition problem, where each segment corresponds to a connected component. Moreover, each pixel is the vertex of the graph. Each edge has a weight,原创 2016-12-02 15:44:49 · 3785 阅读 · 2 评论 -
POJ 3164 Command Network
DescriptionAfter a long lasting war on words, a war on arms finally breaks out between littleken’s and KnuthOcean’s kingdoms. A sudden and violent assault by KnuthOcean’s force has rendered a to原创 2016-12-01 16:57:00 · 354 阅读 · 0 评论 -
UVA 11733 Airports
最小生成森林,其实就是最小生成树的做法,稍加修改即可。#include#include#include#includeusing namespace std;#define rep(i,j,k) for(int i=j;i<=k;i++)#define loop(i,j,k) for (int i=j;i!=-1;i=k[i])#define inone(x) scanf("%d原创 2016-11-30 10:13:06 · 485 阅读 · 0 评论 -
HDU 4786 Fibonacci Tree
Problem Description Coach Pang is interested in Fibonacci numbers while Uncle Yang wants him to do some research on Spanning Tree. So Coach Pang decides to solve the following problem: Conside原创 2016-08-10 17:20:07 · 529 阅读 · 0 评论 -
CSU 1116 Kingdoms
DescriptionA kingdom has n cities numbered 1 to n, and some bidirectional roads connecting cities. The capital is always city 1.After a war, all the roads of the kingdom are destroyed. The kin原创 2015-04-07 12:39:28 · 643 阅读 · 0 评论 -
HDU 5627 Clarke and MST
问题描述克拉克是一名人格分裂患者。某一天克拉克变成了一名图论研究者。 他学习了最小生成树的几个算法,于是突发奇想,想做一个位运算and的最大生成树。 一棵生成树是由n-1n−1条边组成的,且nn个点两两可达。一棵生成树的大小等于所有在生成树上的边的权值经过位运算and后得到的数。 现在他想找出最大的生成树。输入描述第一行是一个整数T(1 \le T \le 5)T(1≤原创 2016-02-18 12:24:15 · 433 阅读 · 0 评论 -
HDU 5723 Abandoned country
Problem DescriptionAn abandoned country has n(n≤100000) villages which are numbered from 1 to n. Since abandoned for a long time, the roads need to be re-built. There are m(m≤1000000) roads原创 2016-07-19 18:33:43 · 939 阅读 · 2 评论 -
PAT (Top Level) Practise 1016 Uniqueness of MST (35)
1016. Uniqueness of MST (35)时间限制400 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CHEN, YueGiven any weighted undirected graph, ther原创 2017-03-04 19:29:00 · 1058 阅读 · 0 评论