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

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