标签:pen isp names find == first match view closed
#include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<algorithm> using namespace std;int match[maxn],link[maxn][maxn],used[maxn],ans; bool find(int u) { /*for(int i=first[u];i;i=next[i]) { if(!used[to[i]]) { used[to[i]]=1; if(!match[to[i]] || find(to[i])) { match[to[i]]=u; return true; } } } return false;*/ for(int i=1;i<=n;i++) { if(!used[i] && link[u][i]) { used[i]=1; if(match[i]==0 || find(i)) { match[i]=u; return true; } } } return false; } int maxmatch() { for(int i=1;i<=n;i++)if(dfs(i))ans++; }
标签:pen isp names find == first match view closed
原文地址:http://www.cnblogs.com/Kong-Ruo/p/7701372.html