資源簡介
網絡流Ford-Fulkerson算法模板
代碼片段和文件信息
#include
using?namespace?std;
const?int?inf=2147483640;
const?int?mxn=11111;
int?nmst;
struct?edge{int?tocaprev;};
vectorg[mxn];
inline?void?add_edge(int?fromint?toint?cap){
g[from].push_back((edge){tocapg[to].size()});
g[to].push_back((edge){from0g[from].size()-1});
}
bool?use[mxn];
int?dfs(int?vint?tint?f){
if(v==t)return?f;
use[v]=1;
for(int?i=0;i edge&e=g[v][i];
if(!use[e.to]?and?e.cap>0){
int?d=dfs(e.totmin(fe.cap));
if(d>
- 上一篇:linux ymodem串口發送
- 下一篇:網絡流dinic算法模板
評論
共有 條評論