Drainage Ditches 最大流
来源:互联网 发布:淘宝打单难不难 编辑:程序博客网 时间:2024/05/17 04:16
Drainage Ditches
Time Limit:1000MS Memory Limit:65536K
Total Submit:12 Accepted:6
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 is the number of ditches that Farmer John has dug. M is the number of intersections points for those ditches. Intersection 1 is the pond. Intersection point M is the stream. Each of the following N lines contains three integers, Si, Ei, and Ci. 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.
Output
For each case, output a single integer, the maximum rate at which water may emptied from the pond.
Sample Input
5 41 2 401 4 202 4 202 3 303 4 10
Sample Output
50
Source
USACO 93
赤裸裸的最大流……花了半下午看懂,后半下午写了一下……
- Drainage Ditches 最大流
- HDU1532 Drainage Ditches 最大流
- NYOJ323 Drainage Ditches 最大流
- HDU1532 Drainage Ditches 【最大流】
- 网络最大流--Drainage Ditches
- POJ1273 Drainage Ditches(最大流)
- POJ1273 Drainage Ditches 【最大流】
- 【最大流】HDOJ 1532 Drainage Ditches
- HDU 1532 Drainage Ditches (最大网络流)
- HDU 1532 Drainage Ditches (最大网络流)
- POJ 1273.Drainage Ditches【最大流】
- hdu 1532 Drainage Ditches(最大网络流)
- 最大流问题 pku 1273 Drainage Ditches
- poj 1273 Drainage Ditches 网络最大流
- POJ1273 Drainage Ditches——最大流
- 网络最大流问题 poj1273 Drainage Ditches
- 【最大流】北大 poj 1273 Drainage Ditches
- POJ-1273 Drainage Ditches【最大流】
- 【网一科技】轻松上Facebook看Youtube的方法
- 世界上第一个使用开源GSM协议栈打出
- java设计模式之Command模式
- 初来乍到,请大家多多关照!
- 都来测试一下你家电脑的性别吧 - 有意思吧
- Drainage Ditches 最大流
- 关于新访问者与回访者
- WINCE上透明图片的绘制
- spring security3 记录用户登录成功后的登录时间
- 用C#打印五角星(大家帮看看,那有问题)
- 45454454545
- 在Win7上安装Oracle
- java小技巧:运行java程序时修改CMD命令默认路径的方法
- 激励人生的十句话(英)