hdu 4807 Lunch Time

转载自 http://blog.csdn.net/qq564690377/article/details/17100011

题意:在一个有向图当中,现在每一条边带有一个容量,现在有K个人在起点,需要到终点去吃饭,询问这K个人最后一个人到达食堂的最小时间是多少。

想法:联想到普通的网络流,那么我们网络流可以很轻松的求出两个点之间的最大容量是多少,但是现在的问题就是刚开始在起步的时候那么最开始的容量是不可能到达最大的,因为人还在途中,假设我们从时间角度来分析这个问题,再联想到我们网络流求法,费用流当中,求出来的就是当然费用最小(也就是路径长度最短)的增广路径,那么从这个时刻之后每个单位时间都有这么多人能够到达餐厅,然后我们在求费用流的过程中,把所有这样找到的增广路径处理掉,按时间递增,如果处理完之后还是没有到达人数,那么接下去每一个时刻到达的人数就是最大流流量,然后接下去的部分直接算出来就可以了,要特别注意k = 0 时的trick。

hdu 4807 Lunch Time,布布扣,bubuko.com

时间: 2024-10-25 02:01:45

hdu 4807 Lunch Time的相关文章

hdu 4807

题意: n个点(0 到 n-1), m条边,每条边花费都是1,容量不同, 有k个人在0点,问,最少需要多少时间所有人能走到点n-1 解决: 建图,跑费用流的过程中贪心一下. 策略如下: 因为跑费用流的时候,每次增广路径的花费是递增的,假设按顺序找出了3条增广路径,w1, w2, w3,花费递增,容量未知,如果最优方案一定是,全部从w1走,或者尽量从w1和w2走,或者是3条路同时走.例子1,假设有一条增广路径,花费1,流量1, 另一条增广路径,花费10,容量1000,只有5个人,解决方案当然是所有

Lunch Time

hdu4807:http://acm.hdu.edu.cn/showproblem.php?pid=4807 题意:给你n个点(0--n-1),点之间是有向边,0号点有k个人,现在0号点的k个人要到n-1号点.每条边有一个容量,就是单位时间内最多允许c个人通过,通过一条边需要一个单位时间,现在问你最后一个到达n-1号点最短的时间是多少. 题解:这题用到网络流.怎么用呢?首先建图,边的容量自然是原来的容量,费用肯定为1.接着,我们可以想.先选一条路径的话,我们肯定选择一条费用最少的,这里就是距离最

Lunch Time(费用流变型题,以时间为费用)

Lunch Time http://acm.hdu.edu.cn/showproblem.php?pid=4807 Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 782    Accepted Submission(s): 183 Problem Description The campus of Nanjing University

HDU 5493 Queue 树状数组

Queue Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5493 Description N people numbered from 1 to N are waiting in a bank for service. They all stand in a queue, but the queue never moves. It is lunch time now,

Temperature hdu 3477

Temperature Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 650    Accepted Submission(s): 208 Problem Description Many people like summer as summer has a lot of advantages, but on the other han

hdu 2604 Queuing(矩阵快速幂乘法)

Problem Description Queues and Priority Queues are data structures which are known to most computer scientists. The Queue occurs often in our daily life. There are many people lined up at the lunch time. Now we define that ‘f’ is short for female and

HDU 2604 Queuing 矩阵高速幂

QueuingTime Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2483    Accepted Submission(s): 1169 Problem Description Queues and Priority Queues are data structures which are known to most computer s

HDU 2604 Queuing

Queuing Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4638    Accepted Submission(s): 2045 Problem Description Queues and Priority Queues are data structures which are known to most computer

矩阵快速幂——HDU 2604

对应HDU题目:点击打开链接 Queuing Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3114    Accepted Submission(s): 1419 Problem Description Queues and Priority Queues are data structures which are known t