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

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<ctype.h>
struct dui{
	int x,y;
};
int main(){
	int l,n,i,a,b,h,w,k=0,f;
	struct dui d[10000];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d",&a,&b);
		f=0;
		if(i==0){
			d[k].x=a;
			d[k].y=b;
			k++;
		}else{ 
			for(l=0;l<k;l++){
				if((a<=d[l].x&&b<=d[l].y)||(b<=d[l].x&&a<=d[l].y)){
					d[l].x=a;
					d[l].y=b;
					f=1;
					break;
				}
			}
				if(f==0)
				{
					d[k].x=a;
					d[k].y=b;
					k++;
				}
			}
			
	}
	printf("%d\n",k);
	}