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: 1836kB
Author: CT12811191281
In contest: 1281

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
using namespace std;
const int maxn=1e4+5;
int a[maxn],b[maxn],n,m;
int main()
{
	int t,i;
	cin>>t>>a[0]>>b[0];
	t--;
	int l=1;
	while(t--)
	{
		scanf("%d%d",&n,&m);
		for(i=0;i<l;++i)
		{
			if((n<=a[i]&&m<=b[i])||(n<=b[i]&&m<=a[i]))
			{
				a[i]=n;
				b[i]=m;
				break;
			}
		}
		if(i==l)
		{
			a[l]=n;
			b[l++]=m;
		}
	}
	printf("%d",l);
}