AtCoder Regular Contest 123
B
Increasing Triples
AtCoder
⌀ 348
原题
← AC →
翻译中…

Problem Statement

翻译中…

Given are three sequences of $N$ integers each: $A = (A_1, \ldots, A_N),\,B = (B_1, \ldots, B_N),\,C = (C_1, \ldots, C_N)$.

翻译中…

You can permute each of these sequences in any way you like. Find the maximum possible number of indices $i$ such that $A_i < B_i < C_i$ after permuting them.

翻译中…

Constraints

翻译中…
  • $1\leq N\leq 10^5$
  • $1\leq A_i, B_i, C_i\leq 10^9$
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N
A_1 A_2 \ldots A_N
B_1 B_2 \ldots B_N
C_1 C_2 \ldots C_N

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
5
9 6 14 1 8
2 10 3 12 11
15 13 5 7 4
Output #1
3
We should permute them as follows: - $A = (1,6,8,9,14)$, - $B = (3,2,10,12,11)$, - $C = (4,7,15,13,5)$. Then, we will have three indices $i$ ($i = 1, 3, 4$) such that $A_i < B_i < C_i$.
Input #2
1
10
20
30
Output #2
1
Input #3
3
1 1 1
1 1 2
2 2 2
Output #3
0
题目信息
题号
arc123_b
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。