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

#include <stdio.h>
int main() {
	int n,h[1000],w[1000],h1,w1,r=1;
	scanf("%d",&n);
	scanf("%d %d",&h[r],&w[r]);
	n--;
	while(n--) {
		int is=0;
		scanf("%d %d",&h1,&w1);
		for(int j=1;j<=r;j++) {
			if((h1<=h[j]&&w1<=w[j])||(w1<=h[j]&&h1<=w[j])) {
				h[j]=h1;
				w[j]=w1;
				is=1;
				break;
			}
		}
		if(is==0) {
			r++;
			h[r]=h1;
			w[r]=w1;
		}
	}
	printf("%d\n",r);
	return 0;
}