Start: Jul, 05, 2019 08:40:00
2019年度暑期短学期达标测试
End: Jul, 05, 2019 11:40:00
Time elapsed:
Time remaining:

Problem_ID: F
Result: Accepted
Time: 4ms
Memory: 1120kB
Author: CT12810801281
In contest: 1281

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
struct shu
{
	int a;
	int b;
};
int main()
{
	struct shu get[1000],get2[1000];
	int n,p = 1;
	scanf("%d",&n);
	for(int i = 0;i < n;i++)
	{
		scanf("%d%d",&get[i].a,&get[i].b);
	}
	get2[0] = get[0];
	for(int i = 1;i < n;i++)
	{
		int k = 1;
		for(int j = 0;j < p;j++)
		{	
			if((get[i].a <= get2[j].a&&get[i].b <= get2[j].b)||(get[i].a <= get2[j].b&&get[i].b <= get2[j].a))
			{
				get2[j] = get[i];
				k = 0;
				break;
			}
		}
		if(k == 1)
		{
			get2[p++] = get[i];
		}
	}
	printf("%d\n",p);
	return 0;
}