#include #define INF 1000000000 int n,g,C[102][102],F,f,m; int q[200],fr[102],qf,ql; void q_a(int a){ q[ql] = a; ql++; } int q_t(void){ qf++; return q[qf-1]; } int min(int a,int b){ if(a>b){return b;}else{return a;} } int bfs(void){ int i,v,br; int rt = -1; qf = 0; ql = 0; q_a(0); for(i=0;i0 && fr[i]==-1){ q_a(i); fr[i] = v; if(i==g){ br = 1; rt = 1; } } } if(br == 1){break;} } return rt; } int main(void){ int v,i,j,k; int W,N,J[50],M,C0[50],Q[50],X[50][50]; scanf("%d %d",&W,&N); for(i=0;i0){ v = g; m = INF; while(v != 0){ m = min(C[fr[v]][v],m); v = fr[v]; } f = m; F += f; v = g; while(v != 0){ C[fr[v]][v] -= f; C[v][fr[v]] += f; v = fr[v]; } } if(F