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: 1764kB
Author: CT12812861281
In contest: 1281

#include <cstdio>
#include <iostream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
int t,n;

struct node
{
	int len,wid;

}aa[1010];
int main()
{
	cin>>t;
	int a,b;
	int cnt=0;
	memset(aa,0,sizeof aa);
	for(int i=0;i<t;i++)
	{
		
		cin>>a>>b;
		int flag=0;
		if(i==0)
		{
			flag=1;
		}
		else{
		for(int i=1;i<=cnt;i++)
		{
			if((aa[i].len>=a&&aa[i].wid>=b))
			{
				aa[i].len=a;aa[i].wid=b;
				break;
			}
			else if(aa[i].wid>=a&&aa[i].len>=b)
			{
				aa[i].len=b;aa[i].wid=a;
				break;
			}
			else if(i==cnt)
				flag=1;
		}
		}
		if(flag)
		{
			cnt++;
			aa[cnt].len=a;
			aa[cnt].wid=b;
		}
	}
	cout<<cnt<<endl;
}