题意
给定一个无向图,要求判定分离两个点的最小割是否唯一。
解法
在求出最大流的后,在残余网络中,从源点进行一次搜索,搜索按照未饱和的边进行,得到顶点子集S的顶点个数;再从汇点反向搜索未饱和的边,得到子集T的顶点个数,判定顶点数相加是否等于总共的顶点数。
如果能到所有顶点,则是唯一的,否则不是唯一
参考代码
#include<iostream>
#include<vector>
#include<queue>
#include<cstdio>
#include<cstring>
using namespace std;
#define ll long long
#define in rad()
inline int rad(){
int x=0,f=1;char c=getchar();while(c>'9'||c<'0')c=getchar();
if(c=='-')f=-1,c=getchar();while(c>='0'&&c<='9')x=x*10+c-48,c=getchar();
return x*f;
}
const int maxn=1e3+10;
const int maxm=4e4+100;
const int inf=1e9;
struct Edge {
int u,v,w,nxt;
} e[maxm];
int first[maxn]= {
},cnt=1,S,T;
inline void add(int u