自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(55)
  • 收藏
  • 关注

原创 hdu 3987(最小割的边数)

题意:给出一张有n个点的图,有的边又向,有的边无向,现在要你破坏一些路,使得从点0无法到达点n-1。破坏每条路都有一个代价。求在代价最小的前提下,最少需要破坏多少条道路。(就是说求在最小割的前提下,最小的割边数)解题思路:求最小割很好办,跑一边最大流即可,但关键是要求最小割边数。这里用到了一个结论:最小割边一定满流,满流的不一定是最小割边。先跑一边最大流,然后把满流的边容量设为1,其它边容量设

2016-05-31 11:32:56 2382

原创 hdu 3046(最小割最大流)

题意:在一个单位方格边长为1的矩阵中藏着灰太狼和它的同伴,等待着喜羊羊和它的同伴,为了不让喜羊羊和同伴被抓住,我们可以在矩形草坪中设置单位长度为1的栅栏,求最短的栅栏长度。解题思路:这道题是要把狼和羊分开,如果熟悉最小割的话,就比较容易了,将所有的羊同源点连一条无穷大的边,狼和汇点连一条无穷大的边,剩下的格子与周围格子连一条容量为1的边,接下来就是求最小割即可。主要是为什么这样建图就是对的,首

2016-05-31 09:39:47 549

原创 hdu 3879(最小割模型求解最大权闭合图)

题意:公司得到了一共N个可以作为通讯信号中转站的地址,而由于这些地址的地理位置差异,在不同的地方建造通讯中转站需要投入的成本也是不一样的,所幸在前期调查之后这些都是已知数据:建立第i个通讯中转站需要的成本为Pi(1≤i≤N)。 •另外公司调查得出了所有期望中的用户群,一共M个。关于第i个用户群的信息概括为Ai, Bi和Ci:这些用户会使用中转站Ai和中转站Bi进行通讯,公司

2016-05-30 21:01:28 390

原创 hdu 4183(最大流)

Pahom on WaterTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionPahom on Water is an interactive computer game inspired by a short story

2016-05-30 10:20:01 382

原创 hdu 3592(差分约束)

World ExhibitionTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionNowadays, many people want to go to Shanghai to visit the World Exhi

2016-05-27 12:43:44 265

原创 hdu 3440(差分约束)

House ManTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionIn Fuzhou, there is a crazy super man. He can’t fly, but he could jump from h

2016-05-27 10:47:36 274

原创 poj 3767(最短路拆边)

I Wanna Go HomeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 3447 Accepted: 1480DescriptionThe country is facing a terrible civil war----cities in the

2016-05-26 21:25:37 867

原创 poj 2353(简单dp+输出路径)

MinistryTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 4808 Accepted: 1549 Special JudgeDescriptionMr. F. wants to get a document be signed by a mi

2016-05-26 20:23:33 344

原创 poj 3660(Floyd求传递闭包)

Cow ContestTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 9317 Accepted: 5249DescriptionN (1 ≤ N ≤ 100) cows, conveniently numbered 1..N, are participa

2016-05-26 19:19:36 282

原创 poj 3615(Floyd变形)

Cow HurdlesTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 7278 Accepted: 3314DescriptionFarmer John wants the cows to prepare for the county jumping co

2016-05-26 17:30:46 285

原创 poj 3013(最短路变形)

Big Christmas TreeTime Limit: 3000MS Memory Limit: 131072KTotal Submissions: 22662 Accepted: 4920DescriptionChristmas is coming to KCM city. Suby the loyal civi

2016-05-26 16:43:54 529

原创 poj 1797(路径限制)

Heavy TransportationTime Limit: 3000MS Memory Limit: 30000KTotal Submissions: 28119 Accepted: 7519DescriptionBackground Hugo Heavy is happy. After the breakdown

2016-05-26 11:30:30 375

原创 poj 1724(Dijkstra+优先队列)

ROADSTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 12737 Accepted: 4704DescriptionN cities named with numbers 1 ... N are connected with one-way roads

2016-05-26 09:29:15 325

原创 hdu 3790(最短路)

最短路径问题Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Problem Description给你n个点,m条无向边,每条边都有长度d和花费p,给你起点s终点t,要求输出起点到终点的最短距离及其花费,如果最短距离有多条路线,则输出花费最少的。 

2016-05-26 09:11:51 251

原创 hdu 1599(Floyd求最小环)

find the mincost routeTime Limit: 1000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Problem Description杭州有N个景区,景区之间有一些双向的路来连接,现在8600想找一条旅游路线,这个路线从A点出发并且最后回到A点,假设经过的路

2016-05-25 21:21:31 308

原创 hdu 4179(限制最短路)

Difficult RoutesTime Limit: 5000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionIn preparation for the coming Olympics, you have been asked to propo

2016-05-25 19:44:12 713

原创 hdu 2145(最短路+排序)

zz's Mysterious PresentTime Limit: 10000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionThere are m people in n cities, and they all want to atten

2016-05-25 09:41:31 322

原创 hdu 3832(最短路拆点)

Earth HourTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 125536/65536 K (Java/Others)Problem DescriptionEarth Hour is an annual international event created by the WWF (World W

2016-05-25 08:35:06 600

原创 hdu 3631(Floyd变形)

Shortest PathTime Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionWhen YY was a boy and LMY was a girl, they trained for NOI (National Ol

2016-05-24 20:25:24 371

原创 hdu 2833(Floyd + dp)

WuKongTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionLiyuan wanted to rewrite the famous book “Journey to the West” (“Xi You Ji” in C

2016-05-24 17:02:45 330

原创 hdu 3873(限制最短路---待解决)

Invade the MarsTime Limit: 5000/2000 MS (Java/Others)    Memory Limit: 365768/165536 K (Java/Others)Problem DescriptionIt's now the year 21XX,when the earth will explode soon.The evil U.S.

2016-05-24 12:46:37 373

原创 hdu 1839(二分+最短路)

Delay Constrained Maximum Capacity PathTime Limit: 10000/10000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Problem DescriptionConsider an undirected graph with N vertices, n

2016-05-23 12:45:41 373 1

原创 hdu 5108(分解质因数)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5108输入N,找一个最小的M,使得N/M为质数。解题思路:面对N/M的问题,而且还是质数问题,可以想到是用分解质因数了,因为N = M*P,P为质数,所以分解N的质因数直到一个最大的P出现即可。#include#include#includeusing namespace st

2016-05-20 21:10:36 425

原创 hdu 5254(暴力穷举)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5254解题思路:暴力枚举即可,没什么好讲的。#include#include#includeusing namespace std;const int maxn = 505;int n,m,g,map[maxn][maxn];bool check(int i,in

2016-05-20 12:49:01 375

原创 hdu 5248(二分+贪心)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5248解题思路:这道题我原本的思路是动态规划,结果看到数很大,结果放弃了。然后想到二分,思路是对的,只是在check()函数时想的太复杂了,没有想到这里有贪心的结构,而采用的是动规去枚举。结果超时了。假设二分枚举到x,那么a[i]就可以尽可能地变小,最小可以小到a[i]-x,这样就可以把数列变成尽可

2016-05-19 21:13:05 311

原创 hdu 5247(RMQ+枚举)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5247解题思路:这道题要求区间的连续性,可以用RMQ解决。首先可以确定的是如果区间的和必须是满足等差数列的求和,否则不会是连续的数。其次还要判断这个区间内的每一个数往左走遇到第一个与它相等的位置。如果该位置在区间内,说明区间内有重复的数。这里可以用RMQ维护。#include#include

2016-05-19 17:31:30 340

转载 hdu 5246(贪心)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5246解题思路:先排序,在采用贪心的方法,先给百小度找到合适的初始战斗力,找到比初始战斗力上限小的中最大的来打,并将初始战斗力和他设置成相同的即可。接下来就是提升战斗力了,如果当前战斗力power+k >= a[i],说明第i个对手是可以打败的并且能够获得战斗力的提升。#include

2016-05-19 16:48:11 259

原创 hdu 4831(线段树---待解决)

Scenic PopularityTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Problem Description  临近节日,度度熊们最近计划到室外游玩公园,公园内部包括了很多的旅游景点区和休息区,由于旅游景点很热门,导致景点区和休息区都聚集了很多人

2016-05-18 20:44:35 285

原创 hdu 2363(限制最短路 二分+枚举+最短路)

CyclingTime Limit: 5000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionYou want to cycle to a programming contest. The shortest route to the contest m

2016-05-17 16:43:05 420

原创 hdu 1546(最短路)

题意:成语接龙的游戏,一个中文字是四个字符组成,所以只要一个字符串后四个字符与另一个字符串的头四个字符能匹配,那么就能接上,求出从第一个到最后一个的最短时间。不知道是建图的问题还是什么,一直WA。。。#include#include#includeusing namespace std;const int maxn = 1005;const int inf = 0x7f

2016-05-15 21:10:03 393 1

原创 hdu 1217(Floyd变形)

ArbitrageTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionArbitrage is the use of discrepancies in currency exchange rates to transform o

2016-05-15 15:34:34 223

原创 hdu 1385(最短路+输出路径)

Minimum Transport CostTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionThese are N cities in Spring country. Between each pair of cit

2016-05-14 13:03:29 511

原创 hdu 2121(无根最小树形图)

Ice_cream’s world IITime Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionAfter awarded lands to ACMers, the queen want to choose a city be

2016-05-13 19:54:01 369

原创 hdu 4496(并查集的边删除)

D-CityTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Problem DescriptionLuxer is a really bad guy. He destroys everything he met.One day Luxer w

2016-05-13 14:45:55 887

原创 hdu 1198(并查集判断连通性)

Farm IrrigationTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionBenny has a spacious farm land to irrigate. The farm land is a rectan

2016-05-13 11:17:30 392

原创 hdu 1856(并查集)

More is betterTime Limit: 5000/1000 MS (Java/Others)    Memory Limit: 327680/102400 K (Java/Others)Problem DescriptionMr Wang wants some boys to help him with a project. Because the projec

2016-05-12 11:22:03 221

原创 hdu 1811(拓扑排序+并查集)

解题思路:拓扑排序的两个性质:①如果一次入队入度为零的点大于1则说明拓扑排序序列不唯一②如果排序的总个数小于给定的个数,则说明存在回路可以先把"="的两个数用并查集放在一个集合里,这样就只剩下">"和"不知道为什么TLE了。。待解决#include#include#include#include#includeusing nam

2016-05-11 23:27:47 299

原创 hdu 1558(线段相交+并查集)

题意:给你一些操作,P后边输入四个值,分别代表一条线段的起点、终点坐标,当输入Q时,后边输入一个整形值K,输出第k条线段所在的集合中包含的线段的个数。解题思路:线段相交+并查集,sum[i]表示i所在的线段集合中,i为根节点的线段总数。在合并时可以更新。#include#includeusing namespace std;struct point

2016-05-11 15:42:54 308

原创 poj 2831(次小生成树)

题意:给你一幅图,再给你Q个询问,每个询问为id cost,即如果将id这条边的边权改为cost的话,这条边是否可能是最小生成树中的一条边解题思路:将第i条边(u,v)的权值修改的话,要判断是否是最小生成树中的一条边,首先要把它加入进去,此时必定会引起原来的生成树成环,所以必定要擦去一条边,擦去的是哪一条边,这就利用到了次小生成树的原理了。之前写过一个次小生成树的题,现在回过头看,

2016-05-10 17:42:47 1137

原创 poj 3164(最小树形图)

有固定根的最小树形图求法O(VE):首先消除自环,显然自环不在最小树形图中。然后判定是否存在最小树形图,以根为起点DFS一遍即可。之后进行以下步骤。设cost为最小树形图总权值。0.置cost=0。1.求最短弧集合Ao (一条弧就是一条有向边)除源点外,为所有其他节点Vi,找到一条以Vi为终点的边,把它加入到集合Ao中。(加边的方法:所有点到Vi的边

2016-05-09 22:20:51 735

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除