Ples
의견: 0
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 \le N \le 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.
| 서브태스크 | 점수 | 설명 |
|---|---|---|
Test 1 | 3점 | None |
Test 2 | 3점 | None |
Test 3 | 3점 | None |
Test 4 | 3점 | None |
Test 5 | 3점 | None |
Test 6 | 3점 | None |
Test 7 | 3점 | None |
Test 8 | 3점 | None |
Test 9 | 3점 | None |
Test 10 | 3점 | None |
Test 11 | 3점 | None |
Test 12 | 3점 | None |
Test 13 | 3점 | None |
Test 14 | 3점 | None |
Test 15 | 3점 | None |
Test 16 | 3점 | None |
Test 17 | 3점 | None |
Test 18 | 3점 | None |
Test 19 | 3점 | None |
Test 20 | 3점 | None |
Test 21 | 3점 | None |
Test 22 | 3점 | None |
Test 23 | 3점 | None |
Test 24 | 3점 | None |
Test 25 | 2점 | None |
Test 26 | 2점 | None |
Test 27 | 2점 | None |
Test 28 | 2점 | None |
Test 29 | 2점 | None |
Test 30 | 2점 | None |
Test 31 | 2점 | None |
Test 32 | 2점 | None |
Test 33 | 2점 | None |
Test 34 | 2점 | None |
Test 35 | 2점 | None |
Test 36 | 2점 | None |
Test 37 | 2점 | None |
Test 38 | 2점 | None |
1
-1800
180001
1700
-180012
-1800 -2200
1900 17002평가 및 의견
Ples
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Ples