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 |
是bug吗??右边可能的点的数量有:12*7=72种可能 为什么要开数组时要开到305才能过,否则就WA?? 代码如下: ////2239 Selecting Courses(匈牙利算法) #include<stdio.h> #include<string.h> int check[85],map[305][85],n,match[85],ref; //为什么这个地方map[],check[],match[]都要开到305才能过?? bool dfs(int u){ for(int i=1;i<=72;i++){//为什么这个地方的72要改为305?? if(map[u][i]>0&&check[i]==0){ check[i]=1; if(match[i]==-1||dfs(match[i])){ match[i]=u; return true; } } } return false; } void pro(){ for(int i=1;i<=n;i++){ memset(check,0,sizeof(check)); if(dfs(i)) ref++; } } int main(){ int t,p,q; while(~scanf("%d",&n)){ memset(map,0,sizeof(map)); memset(match,-1,sizeof(match)); ref=0; for(int i=1;i<=n;i++){ scanf("%d",&t); for(int j=1;j<=t;j++){ scanf("%d%d",&p,&q); map[i][p*12-12+q]=1; //map[p*12-12+q][i]=1; } } pro(); printf("%d\n",ref); } return 0; } 我还只是喳喳,求解答!! Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator