| ||||||||||
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 |
什么是Presentation Error呀?我用染色做的,害怕栈崩。 是不是崩了,没输出? /*UNSOLVED*/ #include<stdio.h> #include<string.h> #define MAXN 2300 int N,R,T,u,v; int cas,si; int clr[MAXN],map[MAXN][MAXN]; void dfs(int st,int pre) { int j; if(pre==0)clr[st]=1; else if(pre==1){clr[st]=2;} else clr[st]=1; for(j=0;j<N;j++){ if(map[st][j]&&clr[j]==0){dfs(j,clr[st]);} else if(map[st][j]&&clr[j]==clr[st]){si=1;return;} } } int main(void) { int jmprt,i,j; freopen("t3","r",stdin); scanf("%d",&T); for(cas=1;cas<=T;cas++){ si=0;memset(clr,0,sizeof(clr)); memset(map,0,sizeof(map)); scanf("%d%d",&N,&R); //printf("NR:%d %d\n",N,R); for(i=0;i<R;i++){ scanf("%d %d",&u,&v); map[u-1][v-1]=map[v-1][u-1]=1; } for(i=0;i<N;i++)if(clr[i]==0&&!si)dfs(i,0); if(si)printf("Scenario #%d:\nSuspicious bugs found!\n",cas); else printf("Scenario #%d:\nNo suspicious bugs found!\n",cas); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator