Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
求助,总是错,不知道怎么回事#include<iostream> #include<cstring> using namespace std; int a[331][331],f[331]; bool t[331]; bool find(int x) { int i; for(i=1;i<=a[x][0];i++) if(t[a[x][i]]) { t[a[x][i]]=0; if((f[a[x][i]]==0)||(find(f[a[x][i]]))) { f[a[x][i]]=x; return 1; } } return 0; } int main() { int n,m,k,i,j,x,ans,p,q; cin>>n; memset(a,0,sizeof(a)); memset(f,0,sizeof(f)); for(i=1;i<=n;i++) { cin>>k; for(j=1;j<=k;j++) { cin>>p>>q; a[i][0]++; a[i][a[i][0]]=(p-1)*12+q; } } ans=0; for(i=1;i<=n;i++) { memset(t,1,sizeof(t)); if(find(i)) ans++; } cout<<ans<<endl; return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator