#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 1e5+10, M = 1e6+10, INF = 0x3f3f3f3f;
int h[N],ecnt,A[N];
struct Edge{
int to,nxt,f, w;
}e[M];
int q[M],vis[N],dis[N], flow[N], pre[N];
int n,m,S,T,E,sum,Enum;
void add(int a,int b,int f,int w)
{
e[ecnt].to = b, e[ecnt].f = f, e[ecnt].w = w, e[ecnt].nxt = h[a], h[a] = ecnt ++;
e[ecnt].to = a, e[ecnt].f = 0, e[ecnt].w = -w,e[ecnt].nxt = h[b], h[b] = ecnt ++;
}
int spfa()
{
memset(dis, 0x3f, sizeof dis);
memset(vis, 0, sizeof vis);
memset(pre, -1, sizeof pre);
int hh = 0, tt = -1;
q[++ tt] = S; dis[S] = 0; vis[S] = 1, flow[S] = INF;
while(hh <= tt)
{
int u = q[hh ++]; vis[u] = 0;
for(int i = h[u]; ~i; i = e[i].nxt)
{
int to = e[i].to;
if(
08-22
529
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
09-16
3万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交