#1042
Unrated
PLES
시간 제한
1s
메모리 제한
32MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Author: Goran Gašić

There are N boys and N girls at a dance party. We have measured their heights. Each boy will only dance with a girl and each girl will only dance with a boy. Everyone will dance with at most one partner. Each boy either wants to dance with a girl who is taller than him or with a girl who is shorter than him. Analogously, each girl either wants to dance with a boy who is taller than her or with a boy who is shorter than her. Boys and girls who are equally tall never want to dance with each other. Respecting everyone's wishes, determine the maximum number of dancing pairs that can be achieved.

입력

The first line of input contains the positive integer N (1 ≤ N ≤ 100 000). The second line of input contains N integers whose absolute values are between 1500 and 2500, inclusive. Their absolute values represent the height of each of the boys in millimetres. Positive height values indicate boys who want to dance with girls taller than themselves, while negative height values indicate boys who want to dance with girls shorter than themselves. The third line of input contains N integers whose absolute values are between 1500 and 2500, inclusive. Their absolute values represent the height of each of the girls in millimetres. Positive height values indicate girls who want to dance with boys taller than themselves, while negative height values indicate girls who want to dance with boys shorter than themselves.

출력

The only line of output must contain the maximum number of dancing pairs.

예제 입력 1

1
-1800
1800

예제 출력 1

0

예제 입력 2

1
1700
-1800

예제 출력 2

1

예제 입력 3

2
-1800 -2200
1900 1700

예제 출력 3

2
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.