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

#include<stdio.h>
#include<math.h>
#include<string.h>
int main(){
	int n,a,b,total=1;
	int c[1000];
	int d[1000];
	int e[1000]={0};
	int f[1000]={0};
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d%d",&a,&b);
		c[i]=a,d[i]=b;
	}
	e[0]=c[0];f[0]=d[0];
	for(int m=1;m<n;m++){
		int flag=1;
		for(int l=0;l<1000;l++){
		if(((c[m]<=e[l])&&(d[m]<=f[l]))||((c[m]<=f[l])&&(d[m]<=e[l]))){
		total+=0;
		flag=0;
		e[l]=c[m],f[l]=d[m];
		break;}
	}
	if(flag){
	total++;
	e[m]=c[m],f[m]=d[m];
	}
}
	printf("%d\n",total);
	return 0;
}