随笔分类 - 网络流
摘要:解题报告:http://blog.sina.com.cn/s/blog_6635898a0100pdlu.html#includeusing namespace std;const int nMax = 405;const int eMax = 1500; struct{ int st, ed, w;}inl[nMax];struct{ int v, cap, cost, next, re;}edge[eMax];int n, ans;int k, edgeHead[nMax];int que[nMax], pre[nMax], dis[nMax];bool vis[nMax]...
阅读全文
摘要:题意以及分析: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...
阅读全文
摘要: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为可选点,这样可保证每次找到...
阅读全文

浙公网安备 33010602011771号