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

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