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: CT12811431281
In contest: 1281

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