【网络流】POJ 1273 Drainage Ditches(译)

Description


Every time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch.

每次约翰先生的牧场下雨,都会在贝茜的心爱的三叶草场留下一个水塘。

This means that the clover is covered by water for awhile and takes quite a long time to regrow.

也就是说,三叶草全部被水顷刻完全被淹没了,还要等很久才能重新长出来

Thus, Farmer John has built a set of drainage ditches so that Bessie's clover patch is never covered in water. 

因此,约翰建了一个排水沟,让贝茜的三叶草场再也不被水淹没。

Instead, the water is drained to a nearby stream. 

相反,让水流到附近的小溪里。

Being an ace engineer, Farmer John has also installed regulators at the beginning of each ditch, so he can control at what rate water flows into that ditch.

作为一个出色的工程师,约翰安装了控制器在每一个渠道的开头,这样他就可以控制流体在渠中的速率。

Farmer John knows not only how many gallons of water each ditch can transport per minute but also the exact layout of the ditches, which feed out of the pond and into each other and stream in a potentially complex network.

约翰不仅知道每条渠每分钟流多少加仑的水,而且准确布设水渠,哪一个流出水塘到另一个水渠和溪流所在的复杂网络。

Given all this information, determine the maximum rate at which water can be transported out of the pond and into the stream.

给出所有信息判断水从水塘到溪流的最大流量。

For any given ditch, water flows in only one direction, but there might be a way that water can flow in a circle. 
对于每个水渠,谁的流动方向只有一个,但这里可能有一条路让水流成一个环装。


Input


The input includes several cases. 

输入包括多组

For each case, the first line contains two space-separated integers, N (0 <= N <= 200) and M (2 <= M <= 200).

每组第一行包括两个用空格隔开的数字N和M

N is the number of ditches that Farmer John has dug. 

N是约翰的水渠数。

M is the number of intersections points for those ditches. 

M是水渠的结点数。

Intersection 1 is the pond. Intersection point M is the stream. 

结点1是水池,M是溪流。

Each of the following N lines contains three integers, Si, Ei, and Ci. 

接下来有N行,每一行有三个数字。

Si and Ei (1 <= Si, Ei <= M) designate the intersections between which this ditch flows. 

分别表示两个点和之间的流量

Water will flow through this ditch from Si to Ei. Ci (0 <= Ci <= 10,000,000) is the maximum rate at which water will flow through the ditch.
谁在si和ei之间流动,流量最大是即将溢出时。

Output

For each case, output a single integer, the maximum rate at which water may emptied from the pond.
输出一个数是最大流量

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值