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: 3ms
Memory: 1120kB
Author: CT12812781281
In contest: 1281

#include <stdio.h>
int main() {
	int n,a,b,ra[1000]={0},rb[1000]={0},i,j,cnt=1;
	scanf("%d",&n);
	scanf("%d%d",&a,&b);
	ra[1] = a;
	rb[1] = b;
	for(i=1;i<n;i++){
		scanf("%d%d",&a,&b);
		for(j=1;j<=cnt;j++){
			if((a<=ra[j]&&b<=rb[j])||(a<=rb[j]&&b<=ra[j])){
				ra[j] = a;
				rb[j] = b;
				break;
			}
		}
		if(j==cnt+1){
			cnt++;
			ra[cnt] = a;
			rb[cnt] = b;
		}
		
	}
	printf("%d",cnt);
}