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: 3ms
Memory: 2020kB
Author: CT12811441281
In contest: 1281

#include<iostream>
#include<algorithm>

using namespace std;

int main(){
	int n;
	cin>>n;
	int p[2][1005],s[2][1005];
	int a,b,date=0,minn,maxx;
	for(int i=0;i<n;i++){
		scanf("%d%d",&a,&b);
		int fff=0;
		minn=min(a,b);maxx=max(a,b);
		for(int j=1;j<=date;j++){
			if(minn<=s[0][j]&&maxx<=s[1][j]){
				fff=1;
				s[0][j]=minn;s[1][j]=maxx;
				break;
			}
		}
		if(!fff){
			date++;
			s[0][date]=minn;s[1][date]=maxx;
		}
	}
	printf("%d",date);
	return 0;
}