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

#include<stdio.h>
#include<math.h>
#include<string.h>
int main(){
	int n,h,w,i,sum,j,f;
	int shuh[1001]={0};
	int shuw[1001]={0};
	scanf("%d",&n);
	sum=0;
	for(i=0;i<n;++i){
		scanf("%d %d",&h,&w);
		if(sum==0){
			shuh[0]=h;
			shuw[0]=w;
			sum++;
		}
		f=0;
		for(j=0;j<sum;++j){
			if(h<=shuh[j]&&w<=shuw[j]){
				shuh[j]=h;
				shuw[j]=w;
	            f=1;
				break;
			}
			else if(w<=shuh[j]&&h<=shuw[j]){
				shuh[j]=w;
				shuw[j]=h;
				f=1;
				break;
			}
		}
		if(f!=1){
		shuh[sum]=h;
		shuw[sum]=w;
		sum++;
		}
	}
	printf("%d",sum);
	return 0;
}