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

Re:很不明白pku上面AC了而九度过不了~~~〒_〒话说也测了大神们的数据可以通过~

Posted by Nrgeup at 2016-09-16 23:13:59 on Problem 1029
In Reply To:很不明白pku上面AC了而九度过不了~~~〒_〒话说也测了大神们的数据可以通过~ Posted by:vermouth0330 at 2016-07-08 20:11:30
> 代码如下
> #include<stdio.h>
> 
> void main()
> {
> 	int n,lines,i,j,num,pos,count,temp;
> 	int flag[1001] = {0};
> 	int left[500];
> 	int right[500];
> 	int less[1000] = {0};
> 	int more[1000] = {0}; 
> 	char ch;
> 	int inequal = 0;
> 	
> 	scanf("%d %d",&n,&lines);
> 
> 	for(i = 0;i < lines*2;i = i+2)
> 	{
> 		
> 		scanf("%d",&num);
> 		for(j = 0;j < num;j++)
> 		   scanf("%d",&left[j]);
> 		for(j = 0;j < num;j++)
> 		   scanf("%d",&right[j]);
> 		getchar();
> 		ch = getchar();
> 		
> 		if(ch == '=')
> 		{
> 			for(j = 0;j < num;j++)
> 			   flag[left[j]] = 1;
> 			for(j = 0;j < num;j++)
> 			   flag[right[j]] = 1;
> 		}
> 		else
> 		{
> 			inequal++;
> 			if(ch == '>')
> 			{
> 				for(j = 0;j<num;j++)
> 				{
> 					temp = left[j]; 
> 					left[j] = right[j];
> 					right[j] = temp;
> 				}
> 			}
> 			
> 			for(j = 0;j < num;j++)
> 			   less[left[j]]++;;
> 			for(j = 0;j < num;j++)
> 			   more[right[j]]++;
> 		}
> 	}
> 	
> 	for(i = 1;i <= n;i++)
> 	{
> 		if(((less[i] + more[i] < inequal) && (less[i] != 0 ||more[i] != 0)) ||(less[i] != 0 && more[i] != 0))
> 		{
> 			flag[i] = 1;
> 		}
> 	}
> 	pos = 0;
> 	count = 0;
> 	for(i = 1;i <= n;i++)
> 	{
> 		if(flag[i] == 0)
> 		{
> 			pos = i;
> 			count++;
> 		}
> 	}
> 	
> 	if(count > 1)
> 	   printf("0\n");
> 	else
> 	   printf("%d\n",pos);
>    
> }

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