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

#include<stdio.h>
#include<math.h>
int main(){
	int n,x,y,sum=1,a,b,c[1000],d[1000],i;
	scanf("%d",&n);
	n=n-1;
		scanf("%d%d",&x,&y);
		c[0]=x;
		d[0]=y;
		while(n--)
		{
			int z=0;
			scanf("%d%d",&a,&b);
			for(i=0;i<sum;++i){
			if((a<=c[i]&&b<=d[i])||(a<=d[i]&&b<=c[i])){
				c[i]=a;
				d[i]=b;
				z=1;
                break;
	}
			}
			if(z==0){
				c[i]=a;
				d[i]=b;
				sum++;
			}
		}
		printf("%d",sum);
	return 0;
}