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: 8ms
Memory: 1120kB
Author: CT12812981281
In contest: 1281

#include <stdio.h>
int main(){
	int n, ss=0,x ,y;
	int a[2][11111];
	int i, j;
	scanf("%d", &n);
	for(i=0; i<n; i++){
		scanf("%d %d", &a[0][i], &a[1][i]);
		if(i>=1){
			for(j=0; j<i; j++){
				if(a[0][i]>0&&a[1][i]>0){
					if(a[0][i]<=a[0][j]&&a[1][i]<=a[1][j]){
						a[0][j]=a[0][i];
						a[1][j]=a[1][i];
						a[0][i]=0;
						a[1][i]=0;
						break;
					}else if(a[0][i]<=a[1][j]&&a[1][i]<=a[0][j]){
						a[1][j]=a[0][i];
						a[0][j]=a[1][i];
						a[0][i]=0;
						a[1][i]=0;
						break;
					}
				}
			}
		}
	}
	for(i=0;i<n;i++){
		if(a[0][i]>0&&a[1][i]>0)
		++ss;
	}
	printf("%d", ss);
	return 0;
}