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

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