#include<iostream> #include<queue> #include<fstream> using namespace std; const int MAXN = 201; int cap[MAXN][MAXN]; //残留网络,初始为原图 int flow[MAXN][MAXN]; int vernum; //节点总数量 int pre[MAXN]; int BFS(const int &s, const int &t) { queue<int>q; memset(pre,-1,sizeof(pre)); q.push(s); pre[s] = s; while (!q.empty()) { int u = q.front(); q.pop(); for (int v=0;v<vernum;v++) { if( (pre[v]==-1)&&(flow[u][v]<cap[u][v] || flow[v][u]>0) ) { pre[v] = u; q.push(v); if (v == t) return 1; } } } return 0; } void TrackBack(const int &s, const int &t) { int v,min = 0x7fffffff; int i=t; while (i != s) { v = pre[i];