摘要: 题意以及分析:http://ycool.com/post/zhhrrm6#rule3 主要是建图,简化图,然后在套最大流的模板。#include #include#includeusing namespace std;struct Node{ int v,cap,flow,next; Node(){} Node(int _v,int _cap,int _flow,int _next) { v=_v; cap=_cap; flow=_flow; next=_next; }};const int INF=1... 阅读全文
posted @ 2013-08-15 20:43 yongren1zu 阅读(148) 评论(0) 推荐(0) 编辑
摘要: EK算法的核心 反复寻找源点 s 到汇点 t 之间的增广路径,若有,找出增广路径上每一段的最小值delta,若无,则结束。 寻找增广路径时用BFS来找,并且更新残留网的值。 找到delta后,则使最大流值加上delta,更新为当前最大的最大流值。 更详细的到:http://www.cnblogs.com/zsboy/archive/2013/01/27/2878810.html SAP算法 1.首先设 h 数组,h[i]表示节点 i 到汇点经过的最少路径数; 2.在一次寻找可行路径的过程中,若此时已到达 i 点,对于,若h[i]=h[j]+1,则j为可选点,这样可保证每次找到... 阅读全文
posted @ 2013-08-15 16:41 yongren1zu 阅读(736) 评论(0) 推荐(0) 编辑