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 |
牛们,我呕血啊!所有Discuss里数据全过了一遍,居然WA!附代码#include<stdio.h> #define maxn 1000 + 5 #define maxk 100 + 5 long n,m,i,j,k,l; long o[maxn]; long u[maxk]; long e[maxk][2][maxk]; long w[maxn]; long x,y; long ans; long r; char c; int main() {/* freopen("in.txt","r",stdin); freopen("out.txt","w",stdout);*/ scanf("%ld%ld",&n,&m); k=0; for(i=1;i<=m;i++) { k++; scanf("%ld",&u[k]); for(j=1;j<=u[k];j++)scanf("%ld",&e[k][0][j]); for(j=1;j<=u[k];j++)scanf("%ld",&e[k][1][j]); c=getchar(); c=getchar(); if(c=='='){for(j=1;j<=u[k];j++)o[e[k][0][j]]=o[e[k][1][j]]=1;k--;} else if(c=='>') for(j=1;j<=u[k];j++) {l=e[k][0][j]; e[k][0][j]=e[k][1][j]; e[k][1][j]=l;} } m=k; for(i=1;i<=n;w[i]=0,i++) for(k=1;k<=2;k++) if(!o[i]) { if(k==1)w[i]=-1; else w[i]=1; for(j=1;j<=m;j++) { x=y=0; for(l=1;l<=u[j];l++) {x+=w[e[j][0][l]]; y+=w[e[j][1][l]];} if(x>=y)break; } if(j>m) {ans=i;r++;} } if(r>1)ans=0; printf("%ld\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