Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

只在TJU上过了.大家帮忙给点数据.这里其他人的数据都没有什么问题

Posted by crackerwang at 2007-09-07 15:13:45 on Problem 1029
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator