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: 3ms
Memory: 1120kB
Author: CT12810881281
In contest: 1281

#include<stdio.h>
#include<math.h>
#include<string.h>
int main()
{
	
	int n,t=1,h,w,f;
	int a[1010][10];
	scanf("%d",&n);
	scanf("%d %d",&a[0][0],&a[0][1]);
	for(int i=1;i<n;i++)
	{
		scanf("%d %d",&h,&w);
		f=0;
		for(int j=0;j<t;j++)
		{
			if(h<=a[j][0]&&w<=a[j][1])
			{
				a[j][0]=h,a[j][1]=w,f=1;
				break;
			}
			else if(h<=a[j][1]&&w<=a[j][0])
			{
				a[j][1]=h,a[j][0]=w,f=1;
				break;
			}
		}
		if(f==0)
		{
			a[t][0]=h,a[t][1]=w;
			t++;
		}
	}
	printf("%d\n",t);
}