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

#include<stdio.h>
#include<string.h>
int main(){
	int n,h,w,i,d=0;
	int a[1000],b[1000];
	scanf("%d",&n);
	while(n--){
		scanf("%d%d",&h,&w);
		for(i=0;i<d;i++){
			if(a[i]>=h&&b[i]>=w||a[i]>=w&&b[i]>=h)
				break;
		}
		if(i==d){
			a[d]=h;
			b[d]=w;
			d++;
		}
		else{
			a[i]=h;
			b[i]=w;
		}
	}
	printf("%d",d);
}