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

#include<stdio.h>
int main()
{
	int h,w,sum,z,g;
	int i,j;
	int b[110][3];
	int n;
	sum=0;
	g=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		z=0;
		scanf("%d %d",&h,&w);
		if(i==0)
		{
			b[0][0]=h;
			b[0][1]=w;
			sum++;
		}
		if(i!=0)
		{
			for(j=0;j<sum;j++)
			{
				if(h<=b[j][0]&&w<=b[j][1])
				{
					b[j][0]=h;
					b[j][1]=w;
					z=2;
					goto aa;
				}
				if(w<=b[j][0]&&h<=b[j][1]&&z!=2)
				{
					b[j][0]=w;
					b[j][1]=h;
					z=3;
					goto aa;
				}
			}
			if(z==0)
				{
					b[sum][0]=h;
					b[sum][1]=w;
					sum++;
				}
		}
		aa: g=1;
	}
	printf("%d\n",sum);
	return 0;
}