#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define LL long long #define mm(a,b) memset(a,b,sizeof(a)) const double eps=1.0e-6; const double PI=acos(-1.0); templateT gcd(T a,T b){return b==0?a:gcd(b,a%b);} templateT lcm(T a,T b){return a/gcd(a,b)*b;} templateT _abs(T a){return a>0?a:-a;} typedef pair P; const int maxn=3010; const int inf=1<<30; struct edge { int to,w,next,v; }e[maxn*maxn]; int n,m,cnt,head[maxn]; int mp[maxn][maxn],fa[maxn]; void add(int x,int y,int z) { e[cnt].to=y; e[cnt].w=z; e[cnt].v=0; e[cnt].next=head[x]; head[x]=cnt++; e[cnt].to=x; e[cnt].w=z; e[cnt].v=0; e[cnt].next=head[y]; head[y]=cnt++; } int find(int x) { return fa[x]=fa[x]==x?x:find(fa[x]); } bool lt()//并查集判定图是否连通 { for(int i=1;i<=n;i++) { int fx=find(i); if(fx!=fa[1]) return false; } return true; } int S,T;//最后并入集合的两点 int w[maxn];//点的权值 bool vis[maxn];//点是否在集合中 bool st[maxn];//点是否已经合并 int solve(int num)//找S-T的最小割 { int mincut=0; mm(w,0); mm(vis,0); priority_queue

q; for(int i=head[1];~i;i=e[i].next) if(!st[e[i].to]&&!vis[e[i].to]) { w[e[i].to]+=e[i].w; q.push(P(w[e[i].to],e[i].to)); } vis[1]=1; for(int i=1;i q; for(int i=1;i