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

#include<stdio.h>
#include<math.h>
int main(){
	int n;
	int h,w,max=0,min=0,tot=0,r=0,i;
	int A[1001][2];
	scanf("%d",&n);
	for(int j=0;j<n;++j){
		scanf("%d%d",&h,&w);
		if(h>w){
			max=h;
			min=w;
		}
		else{
			max=w;
			min=h;
		}
		for(i=0;i<r;++i){
			if(max<=A[i][0]&&min<=A[i][1]){
				A[i][0]=max;
				A[i][1]=min;
				break;
			}
		}
		if(i==r){
			A[r][0]=max;
			A[r][1]=min;
			r++;
		}
	}
	printf("%d\n",r);
	return 0;
}