Start: Jul, 05, 2019 08:40:00
2019年度暑期短学期达标测试
End: Jul, 05, 2019 11:40:00
Contest has ended!
Time elapsed: 03:00:00
Time remaining: 00:00:00

Problem_ID: F
Result: Accepted
Time: 4ms
Memory: 1764kB
Author: CT12812031281
In contest: 1281

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<stdlib.h>
#include<math.h>
#include<map>
#include<set>
#include<queue>
#include<vector>
using namespace std;
int T,t,x,y,z,m,n,k,f;
//char s[1100];
//double p,q;
struct Arr{
	int h,w;
}arr[1010];
int main()
{
	k=1;
	scanf("%d",&n);
	scanf("%d %d",&arr[1].h,&arr[1].w);
	for(int i=2;i<=n;i++){
		scanf("%d %d",&x,&y);
		f=0;
		for(int j=1;j<=k&&f==0;j++){
			if((arr[j].h>=x&&arr[j].w>=y)||(arr[j].h>=y&&arr[j].w>=x)){
				arr[j].h=x,arr[j].w=y;f=1;
			}
		}
		if(f==0) arr[++k].h=x,arr[k].w=y;
	}
	printf("%d",k);
	
}