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

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
	int h,w,c,i,n,j,b[1001][2],d;
	scanf("%d",&n);
	c=1;
	scanf("%d %d",&b[0][0],&b[0][1]);
	for(j=0;j<n-1;j++){
		scanf("%d %d",&h,&w);
		for(i=0;i<c;i++){
			d=0;
			if(h<=b[i][0]&&w<=b[i][1]){
				b[i][0]=h;
				b[i][1]=w;
				d=1;
				break;
			}
			else if(h<=b[i][1]&&w<=b[i][0]){
				b[i][0]=h;
				b[i][1]=w;
				d=1;
				break;
			}
		}
		if(d==0){
			b[c][0]=h;
			b[c][1]=w;
			c++;
		}
	}
	printf("%d",c);
	return 0;
}