I:trainage Ditches
总时间限制: 1000ms 内存限制: 65536kB
描述
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.
输入
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.
输出
For each case, output a single integer, the maximum rate at which water may emptied from the pond.
样例输入
5 4
1 2 40
1 4 20
2 4 20
2 3 30
3 4 10
样例输出
50
I:trainage Ditches的更多相关文章
- POJ 1273 Drainage Ditches题解——S.B.S.
Drainage Ditches Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 67823 Accepted: 2620 ...
- POJ1273Drainage Ditches[最大流]
Drainage Ditches Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 71559 Accepted: 2784 ...
- poj1273 Drainage Ditches
Drainage Ditches Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 68414 Accepted: 2648 ...
- POJ 1273 Drainage Ditches
Drainage Ditches Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 67387 Accepted: 2603 ...
- HDU1532 Drainage Ditches 网络流EK算法
Drainage Ditches Problem Description Every time it rains on Farmer John's fields, a pond forms over ...
- POJ-1273 Drainage Ditches 最大流Dinic
Drainage Ditches Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 65146 Accepted: 25112 De ...
- POJ 1273 Drainage Ditches -dinic
dinic版本 感觉dinic算法好帅,比Edmonds-Karp算法不知高到哪里去了 Description Every time it rains on Farmer John's fields, ...
- HD1532Drainage Ditches(最大流模板裸题 + 邻接表)
Drainage Ditches Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- Drainage Ditches(dinic)
Drainage Ditches Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 59210 Accepted: 2273 ...
随机推荐
- cmake 出现问题
问题: CMake Error at CMakeLists.txt:3 (find_package): By not providing "FindOpenCV.cmake" in ...
- spring security 3.2 配置详解(结合数据库)
没事就来了解下spring security.网上找了很多资料.有过时的,也有不是很全面的.各种问题也算是让我碰了个遍.这样吧.我先把整个流程写下来,之后在各个易混点分析吧. 1.建立几个必要的页面. ...
- c++的多线程和多进程
一.多进程和多线程对比 多进程:进程不止一个,开销比较大,通信方式比较复杂(可以用过管道.文件.消息队列进行通信),维护成本不高. 多线程:利用共享内存的方式进行指令的执行,开销比较低,但是维护起来比 ...
- Spark HA实战
Spark HA需要安装zookeeper,推荐稳定版3.4.6. 1.下载zookeeper3.4.6,2.配置环境变量3.创建data logs4.vi conf/zoo.cfg5 data目录中 ...
- 【leetcode❤python】 204. Count Primes
#-*- coding: UTF-8 -*- #Hint1:#数字i,i的倍数一定不是质数,因此去掉i的倍数,例如5,5*1,5*2,5*3,5*4,5*5都不是质数,应该去掉#5*1,5*2,5*3 ...
- VC++2013出现bug: 无法打开源文件“stdafx.h”
VC++2013出现bug: 无法打开源文件“stdafx.h” 1.首先需要把#include "stdafx.h"置于最头 2.在解决方案资源管理器中添加以下几个文件(附图下)
- iOS常见面试题
一.为什么要在主线程中更新UI,这样做有什么好处? UIKit中的大部分类都不是“线程安全”的,为了解决这个线程不安全的问题,苹果推荐所有应用程序的UI操作都在主线程中执行,这样就不会出现多个线程同时 ...
- Cheatsheet: 2016 06.01 ~ 6.30
Other Swift for the Java guy: Part 1 – Getting Started Building a better code review process Creatin ...
- Missing artifact com.microsoft.sqlserver:sqljdbc4:jar:4.0
maven构建项目的时候遇到这个错误: 一.直接原因 制定路径下确实没有sqljdbc4.jar文件. 二.根本原因 微软不允许以maven的方式直接下载该文件. 三.解决办法 3.1 手动下载相关库 ...
- OpenLayers图形与列表互动
项目上遇到这样一种需求:查询数据库后得到结果(带地理位置的)列表,每个结果在地图上都是一个四边形,四边形之间有交叉,有重叠,需要实现地图上的四边形和结果列表的互动.抛开其他逻辑功能,互动需求可以表示为 ...