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: 5ms
Memory: 1756kB
Author: CT12811941281
In contest: 1281

#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<map>
#include<math.h>
#include<map>
using namespace std;
const int maxn=100020;
const int inf=0x3f3f3f;
int main(){
	int t;
	cin>>t;
	int x,y;
	int cnt=1;
	int a[2000],b[2000];
	memset(a,0,sizeof a);
	memset(b,0,sizeof b);
	cin>>x>>y;
	a[1]=x;
	b[1]=y;
	t--;
	while(t--){
		cin>>x>>y;
		int flag=0;
		for(int i=1;i<=cnt;i++){
			if(x<=a[i]&&y<=b[i]||x<=b[i]&&y<=a[i]){
				a[i]=x;
				b[i]=y;
				flag=1;
				break;
			}
		}
		if(flag==0){
			++cnt;
			a[cnt]=x;
			b[cnt]=y;
		}
	}
	cout<<cnt<<endl;
}