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

#include<stdio.h>
int main()
{
	int t,a[1010][3],h,w,i,res=1;
	scanf("%d",&t);
	scanf("%d %d",&a[0][0],&a[0][1]);
	int m=t-1;
	while(m--){
		int flag=0;
		scanf("%d %d",&h,&w);
		for(i=0;i<res;i++){
			//printf("A[%d]%d-%d\n",i,a[i][0],a[i][1]);
			if((h<=a[i][0]&&w<=a[i][1]) || (w<=a[i][0]&&h<=a[i][1])){
				a[i][0]=w;
				a[i][1]=h;
				flag=1;
				break;
			}
		}
		if(!flag){
			res++;
			a[i][0]=w;
			a[i][1]=h;
		}
		//printf("B[%d]%d-%d\n",i,a[i][0],a[i][1]);
	}
	printf("%d\n",res);
}