匈牙利算法
int ans = 0; bool find(int i){ for(int j = h[i];j!=-1;j=ne[j]){ int k = e[j]; if(!st[k]){ st[k] = true; if(!match[k] || find(match[k])){ match[k] = i; return true; } } } return false; } for(int i =1;i<=n;i++){ memset(st,false,sizeof st); if(find(i)) ans++; } cout<<ans<<endl;