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

#include<stdio.h>
#include<math.h>
#include<string.h>
int main(){
int n,h,k,w,l,s,i;
int a[10000];
scanf("%d",&n);
scanf("%d%d",&h,&w);
	if(h>=w){
		l=h;s=w;}
	else{ l=w;s=h;}
	a[0]=l;
	a[1]=s;
	k=1;
while(n>1){
	scanf("%d%d",&h,&w);
	if(h>=w){
		l=h;s=w;}
	else{ l=w;s=h;}
	for(i=0;i<k;i++){
	if(l<=a[i*10]&&s<=a[i*10+1]){
		a[i*10]=l;a[i*10+1]=s;break;}
	}
	if(i==k){
		a[k*10]=l;
		a[k*10+1]=s;
		k++;
	}
	n--;
}
printf("%d\n",k);


}