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 |
为什么USACO上全过,这里会WART,请高手过目 #include <cstdio> #include <cstring> int m,n,i,j,k,p; int w[205][205],opp[205]; bool mark[205]; char d[1000]; bool Extend_Path(int u) { for (int i=1;i<=w[u][0];++i) { int v=w[u][i]; if (!mark[v]) { mark[v]=1; if (!opp[v] || Extend_Path(opp[v])) { opp[v]=u; return 1; } } } return 0; } int main() { freopen("stall4.in","r",stdin); freopen("stall4.out","w",stdout); scanf("%d%d\n",&n,&m); for (i=1;i<=n;++i) { gets(d); int x=0,len=strlen(d),p=0; for (j=0;j<len;++j) { if (d[j]>=48 && d[j]<=57) x=x*10+d[j]-48; else { if (p!=0) w[i][++w[i][0]]=x; else ++p; x=0; } } if (x!=0) w[i][++w[i][0]]=x; } int ans=0; for (i=1;i<=n;++i) { memset(mark,0,sizeof(mark)); if (Extend_Path(i)) ++ans; } printf("%d\n",ans); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator