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

#include<stdio.h>
int main(){
	int t,x;
	int s;
	int h,w;
	int a[1010],b[1010],i,n=1;
	for(i=1;i<=1009;i++){
		a[i]=0;
		b[i]=0;
	}
	scanf("%d",&t);
	for(x=1;x<=t;x++){
		scanf("%d %d",&h,&w);
		for(i=1;i<=n;i++){
			if((h<=a[i]&&w<=b[i])||(h<=b[i]&&w<=a[i])){
				n=n;
				a[i]=h;
				b[i]=w;
				s=1;
				break;
			}
			else s=0;
		}
		if(s==0){
			a[n]=h;
			b[n]=w;
			n=n+1;
		}
	}
	printf("%d\n",n-1);
}