#include<cstdio> #include<cstring> #include<cstdlib> #include<cmath> #include<algorithm> #include<vector> #include<queue> #include<iostream> using namespace std; struct EDGE{ int from,to,flow,cap; EDGE(int x=0,int y=0,int z=0){from=x;to=y;flow=0;cap=z;} }; /* 用法:(1) clearMap (2) addEdge 节点个数由addEdge自动计算 (3) solve(s,t) */ class ISAP{ #define INF 0x7fff0000 #define MXNODES 110 private: int s,t,n; //n表示节点下标<=n,最多n+1个节点(节点0不用,则最多n个节点)。n由输入的边自动生成。 vector<EDGE> e; vector<int> g[MXNODES]; queue<int>q; int num[MXNODES]; int cur[MXNODES]; int d[MXNODES]; int p[MXNODES]; //增光路edge下标 int augment(); //添加一条增光路,数组记录路径。p[u]表示存在一条e[p[u]]的边连向u。 int bfs();
[ACM模板]Network Flows网络流 ISAP
最新推荐文章于 2022-05-27 16:44:01 发布