E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
Ditches
poj 1273 Drainage
Ditches
--网络流
#include #include #include usingnamespacestd; intmap[201][210]; intn,m; intf[210]; intpre[210]; intbfs()//广搜找增广路径 { queueq; inttop,i; memset(pre,-1,sizeof(pre));//置前驱 f[1]=999999999;//流到这儿的可增大的流 q.pus
qq172108805
·
2012-04-05 20:00
POJ 1273 Drainage
Ditches
转载请注明出处:http://blog.csdn.net/drecik__/article/details/7406127/* *第二道网络流,直接套用之前1149的连续最短增广路法; *由于未考虑到重边,无耻的WA了一次; */ #include #include #include #include usingnamespacestd; #defineMAXN205
Drecik__
·
2012-03-29 10:00
c
struct
网络
【最大流】北大 poj 1273 Drainage
Ditches
/* THE PROGRAM IS MADE BY PYY */ /*----------------------------------------------------------------------------// Copyright (c) 2011 panyanyany All rights reserved. URL : http://po
panyanyany
·
2012-01-01 16:00
ACM
网络流
pku
【最大流】北大 poj 1273 Drainage
Ditches
/* THE PROGRAM IS MADE BY PYY */ /*----------------------------------------------------------------------------// Copyright (c) 2011 panyanyany All rights reserved. URL : http://poj.org/probl
txf2004
·
2012-01-01 16:00
poj
【最大流】北大 poj 1273 Drainage
Ditches
/*THEPROGRAMISMADEBYPYY*/ /*----------------------------------------------------------------------------// Copyright(c)2011panyanyanyAllrightsreserved. URL:http://poj.org/problem?id=1273 Name:1273Dra
panyanyany
·
2012-01-01 16:00
网络最大流问题 poj1273 Drainage
Ditches
网络最大流问题。其实想法很直观,就是找一条流的路径,然后取这条路径上的最大流量,然后更新约束条件,然后再找这样的路径。。。直到没有能继续的路径。 找路径的方法使用的是广度优先搜索。 ps:最近在练习c语言,c语言虽然用起来比c++墨迹,各种注意事项,但是运行速度上跟c++的确不在一个量级上。15msAC,源代码:/* *======================================
mazheng1989
·
2011-12-07 10:00
poj 1273 Drainage
Ditches
poj1273DrainageDitches果的网络流,有重边#include #include #include #include using namespace std;const int N=210;int n, m;int mat[N][N];int EKarp(int s, int t){ queue que; int flow[N][N], pre[N], temp[N]
purplest
·
2011-09-16 23:00
poj1273 Drainage
Ditches
基础的网络最大流。。。Edmonds-Karp算法飘过。。#include#includeusingnamespacestd;structnode{ intnum,value; };constintsize=210;intmapp[size][size];//原流量intresmapp[size][size];//残余流量intfather[size];boolvisited[
zhang360896270
·
2011-07-24 10:00
c
算法
网络
POJ 1273 Drainage
Ditches
(Networks flow)
很水的网络流,要注意下建图的时候是+=而不是直接赋值,考虑到有重复路径#include#include#include#definemin(a,b)((a)>(b))?(b):(a)usingnamespacestd;constintmaxn=205;constintInf=0x7fffffff;intm,n;intflow[maxn][maxn],cap[maxn][maxn],cf[maxn]
jxy859
·
2011-07-22 15:00
poj 1273 Drainage
Ditches
/*Name:poj1273DrainageDitchesAuthor:UnimenSunDate:08/06/1121:41Description:祼的最大流*//*解题报告:祼的最大流用Edmonds_Karp算法即可,处理图时注意有重边注:该题的解法,即Edmonds_Karp函数是最大流问题的模板*/#include#include#include#includeusingnamespac
Unimen
·
2011-06-18 18:00
c
Date
算法
POJ 1273 Drainage
Ditches
POJ1273DrainageDitches求网络流的最大流。注意:可能出现重边!比如第一次c[u][v]=w1,又有c[u][v]=w2,那么从u到v的容量应该为w1+w2!以下是我的代码:#include#include#include#include#define kS 1#define kT nusing namespace std;const int kMaxn(207);int n,m
心如止水
·
2011-05-28 16:00
hdu1532 Drainage
Ditches
Drainage DitchesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2465 Accepted Submission(s): 1122Problem DescriptionEvery time it rains on Fa
magicnumber
·
2011-03-22 15:00
算法
POJ1273 Drainage
Ditches
(裸最大流,EK,DINIC)
注意重边。EK:#include #include #include #definemin(a,b)aQ; Q.push(1); min_flow[1]=INF; while(!Q.empty()){ u=Q.front(); Q.pop(); if(u==m)break; for(inti=2;i0){ pre[i]=u;//保存前驱,同时标记是否已访问 min_flow[i]=min(min_
l04205613
·
2011-03-03 21:00
c
struct
网络
poj 1273 Drainage
Ditches
最大流第一题,水题。 大概意思就是求从源点到汇点的最大流啦。 WA了数次,看讨论,发现可能有重边==。。。边上的流量要加起来,好阴险啊。。。 白皮书上的模板~EK算法,增广路~看懂了,嘻嘻。自己能写下来了,很好呀~哇咔咔。。 #include#include#include#include#include#include#defineMAX250usingnamespacestd;intcap[
zxy_snow
·
2011-02-06 19:00
c
算法
USACO 4.2.1 Drainage
Ditches
(最大流, Edmonds_Karp)
USACO4.2.1DrainageDitches(最大流,Edmonds_Karp)标准的最大流.注意有重边.重复边直接累加./**//*ID: lorelei3TASK: ditchLANG: C++*/#include #include #include using namespace std;const int INF = 0x7FFFFFF;const int MAXN = 205;in
小阮的菜田
·
2011-01-24 22:00
HDU 1532 Drainage
Ditches
第一次做网络流题目,写个报告巩固一下哈。 ProblemDescriptionEverytimeitrainsonFarmerJohn'sfields,apondformsoverBessie'sfavoritecloverpatch.Thismeansthatthecloveriscoveredbywaterforawhileandtakesquitealongtimetoregrow.Thus
pvpishard
·
2010-12-29 18:00
网络
Integer
input
each
output
Forms
pku 1273_Drainage
Ditches
最大流问题
经典网络流问题,使用Ford Fulkson算法。 思路大概是:求排水沟网络中的最大排水量。 从源点开始,每次寻找一条增广路径,更新一次,再重新找增广路径……直到没有为止。即每次寻找一条由源点到汇点的路径; 把路径全部找完之后,剩余网络是最优网络,即能实现最大流。 寻找增广路径时我使用了广搜,这是比较容易实现的过程。 详细代码: Source Code
mmdev
·
2010-10-31 19:00
pku
POJ 1273 Drainage
Ditches
最水的一个最大流题目,本题需要注意的就是图中可能有平行边,这个时候只需要把同起点同终点的变得值加起来。 有点小激动。。。 #include#include#include#includeusingnamespacestd;queueq;intmain(void){intn,m,i,f,u,v;intfrom,to,w;intcap[201][201],a[201],p[201];intflow[2
dangwenliang
·
2010-09-28 23:00
POJ 1273 Drainage
Ditches
最水的一个最大流题目,本题需要注意的就是图中可能有平行边,这个时候只需要把同起点同终点的变得值加起来。 有点小激动。。。 #include#include#include#includeusingnamespacestd;queueq;intmain(void){intn,m,i,f,u,v;intfrom,to,w;intcap[201][201],a[201],p[201];intflow[2
dangwenliang
·
2010-09-28 23:00
PKU 1273 Drainage
Ditches
PKU1273DrainageDitches问题:http://acm.pku.edu.cn/JudgeOnline/problem?id=1273思路:第一道最大流,Edmonds-Karp算法参考了别人的代码,其实自己也能写出来,不过肯定没有这么精致(*^__^*)嘻嘻……从别人的代码里学到很多,例如:一条路径只需要pre[]数组进行保存即可,路径的残留容量也可以边扩展(BFS)边记录,还有代
A Za, A Za, Fighting...
·
2010-09-16 21:00
Problem POJ1273--Drainage
Ditches
(Maximum-Flow Basic)
ProblemPOJ1273--DrainageDitches(Maximum-FlowBasic)POJ1273-DrainageDitchesAnalysis:Thisproblemrequiresthatwefindthemaximumflowoveragivennetwork,explicitly.InGraphTheory,thisiscatagorizedastheMaximum-Fl
不过一笑
·
2010-08-21 10:00
Drainage
Ditches
最大流
DrainageDitchesTimeLimit:1000MS MemoryLimit:65536KTotalSubmit:12Accepted:6DescriptionEverytimeitrainsonFarmerJohn'sfields,apondformsoverBessie'sfavoritecloverpatch.Thismeansthatthecloveriscoveredbywat
abcjennifer
·
2010-08-15 17:00
Stream
Integer
input
each
output
Forms
POJ1273 Drainage
Ditches
(网络流&增广路)
/*PKU1273DrainageDitches Edmonds-KarpMaximumFlow O(VE^2)*/#include#includeusingnamespacestd;constintN=210;intad[N][N],flow[N][N];intpre[N],inc[N];intn,m;boolBFS(intad[N][N],intsrc,intdes){ queueq;
Paradise_for_why
·
2010-08-13 13:00
网络
hdu 1532 Drainage
Ditches
(最大网络流)
http://acm.hdu.edu.cn/showproblem.php?pid=1532 解题思路:网络流模板 #include#defineMax205intN,M;intGraph[Max][Max];intpre[Max];/*记录前驱点*/boolvisited[Max];voidInitGraph(){inti,j;for(i=1;iGraph[u][v])min=Graph[u]
q3498233
·
2010-08-07 16:00
c
网络
struct
Graph
POJ 1273.Drainage
Ditches
【最大流】
不用多说了,赤裸裸的最大流,典型的模板题。dinic算法实现。 #include#include#include#include#defineINF0x1f1f1f1f#defineMAXN205usingnamespacestd;intn,m,src,sink;//点数,边数,源点,汇点intrestflow[MAXN][MAXN],level[MAXN];/
ji414341055
·
2010-07-26 01:00
算法
iterator
USACO Training Section 4.2 Drainage
Ditches
ISAP非递归和多路增广递归
郁闷。不小心覆盖了重写的。 英文原题 中文题译 最原始经典的网络流最大流问题,本身没什么好说的。网上关于网络流和算法的小blog不少,良莠不齐,这里推荐一篇辉夜的blog,里面有各个算法的大致介绍和简单评测。评测数据来自于topcoder上一篇更严谨的英文文章《Maximum Flow: Augmenting Path Algorithms Comparison
blackcoffee
·
2010-01-29 19:00
编程
算法
面试
Blog
HDU 1532 Drainage
Ditches
(最大网络流)
DrainageDitchesTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):896 AcceptedSubmission(s):414ProblemDescriptionEverytimeitrainsonFarmerJohn'sfields,apon
akof1314
·
2009-11-21 01:00
【最大流】HDOJ 1532 Drainage
Ditches
#include#defineMAX205intGraph[MAX][MAX];structqueue{intque[MAX];inthead;inttail;};voidInit(){inti,j;for(i=0;i
cclsoft
·
2009-09-25 14:00
Integer
Graph
input
each
output
Forms
pku 1273 Drainage
Ditches
pku1273DrainageDitches最大流http://acm.pku.edu.cn/JudgeOnline/problem?id=1273#includeusing namespace std;#define MAXN 210#define inf 2110000000int con[MAXN][MAXN];int f[MAXN][MAXN]; //求网络最大流,邻接阵形式//返回最大流
蔡东赟
·
2009-02-14 15:00
Pku 1273 Drainage
Ditches
Pku1273DrainageDitches#include #include #include #include using namespace std;#define N 210int point, edge;int graph[N][N];int pre[N];int result= 0;void update( int mflow ){ int b= point;
算法学习
·
2008-11-04 14:00
上一页
1
2
3
4
5
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他