标签:ret namespace set class color eof turn name can
#include<bits/stdc++.h> #define maxn 100000 using namespace std; vector <int> s[maxn]; int n,m,k,x,y,ans; int g[maxn],zou[maxn]; int oj(int x) { for(int i=0;i<s[x].size();i++) { int zhong=s[x][i]; if(!zou[zhong]) { zou[zhong]=1; if(!g[zhong] || oj(zou[zhong])) { g[zhong]=x; return 1; } } } return 0; } main(){ while(scanf("%d%d",&n,&m)==2)//n个点,m条边 { for(int i=1;i<=maxn;i++) { s[i].clear(); g[i]=0; } for(int i=1;i<=m;i++) { scanf("%d%d",&x,&y); s[x].push_back(y); } for(int i=1;i<=n;i++) { memset(zou,0,sizeof(zou)); if(oj(i)) ans++; } printf("%d\n",ans); ans=0; } }
标签:ret namespace set class color eof turn name can
原文地址:http://www.cnblogs.com/kczno1fans/p/7521598.html