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

#include <stdio.h>
#include <string.h>
int main()
{
	int n,i,j;
	scanf("%d",&n);
	int h,w,h1,w1,k=0,sum=1,kk=0;
	int a[10011];
	while(n--)
	{
		scanf("%d%d",&h,&w);
		if(kk==0)
		{
		a[k]=h;
		a[k+1]=w;
		k=k+2;
		kk++;
		goto ha;
		}
		
		for(i=0;i<k;i=i+2)
		{
			if((a[i]>=h&&a[i+1]>=w)||(a[i+1]>=h&&a[i]>=w))
			{
				a[i]=h;
				a[i+1]=w;
				goto ha;
			}
		}
			a[k]=h;
			a[k+1]=w;
			k=k+2;
			sum++;
			ha:;
		
	}
		printf("%d\n",sum);
	return 0;
}