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 |
只在TJU上过了.大家帮忙给点数据.这里其他人的数据都没有什么问题In Reply To:Re:该不是有不和逻辑的数据把.比如1<2然后又来个2<1 Posted by:crackerwang at 2007-09-07 15:11:03 #include<stdio.h> bool a[1002]; bool b[1002]; int main() { int i,j,n,m,k; char ch; while(scanf("%d%d",&n,&m)!=EOF) { for(i=1;i<=n;i++) b[i]=a[i]=0; while(m--) { scanf("%d",&k); for(i=1;i<=2*k;i++) { scanf("%d",&j); b[j]=1; } getchar(); scanf("%c",&ch); if(ch=='<'||ch=='>') { for(i=1;i<=n;i++) { a[i]=a[i]||!b[i]; b[i]=0; } } else { for(i=1;i<=n;i++) { a[i]=a[i]||b[i]; b[i]=0; } } } for(k=j=0,i=1;i<=n;i++) { if(!a[i]) j++,k=i; } if(j==1) printf("%d\n",k); else printf("0\n"); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator