프로그램 명: coci_ples
제한시간: 1 초
[문제요약] N 명의 보이와 걸이 댄스파티에서 짝을 맞추어 춤을 추려고 할 때 어떤 이는 자기보다 더 작은 사람과
어떤 이는 자기 보다 큰 사람과 춤을 추고 싶어 한다.
입력의 첫 줄에 인원 N 이 주어지고 다음 줄에는 남자의 키가 다음 줄에는 여자의 키가 양/음으로 주어짐.
이 수의 절대값이 각자의 키. 양수는 더 큰 사람과 음수는 더 작은 사람과 춤을 추고 싶어한다고 할 때 가장 많은 짝을 만들수 있는 짝의 수를 구하는 문제
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.
입출력 예
input
1
-1800
1800
output
0
input
1
1700
-1800
output
1
input
2
-1800 -2200
1900 1700
output
2
출처:coci 2011 contest1 4/6
[질/답]
[제출 현황]
[푼 후(0)]