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

#include<stdio.h>
#include<string.h>
#include<string.h>
int main(){
	int n;
	int a[1010];
	int b[1010];
	int x,y;
	int num=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d %d",&x,&y);
		if(num==0){
			a[num]=x;
			b[num]=y;
			num++;
		}
		else{
			int ture=0;
			int t;
			for(int j=0;j<num;j++){
				if((x<=a[j]&&y<=b[j])||(x<=b[j]&&y<=a[j])){
					t=j;
					ture=1;
					break;
				}
			}
			if(ture==1){
				a[t]=x;
				b[t]=y;
			}
			else {
				a[num]=x;
				b[num]=y;
				num++;
			}
		}
	}
	printf("%d",num);
}