cswork / OA打开练习工作台

JPMorgan ChaseOA #12

Pairs

估计中等可在线判题

考点(AI 标注)双指针滑窗贪心调度

Form pairs by taking one element each from arrays a and b of equal length, where the element from a must be strictly greater than the element from b. Each position can be used at most once; find the maximum number of pairs.

输入格式

The first line contains n, the second line contains a, and the third line contains b; 1≤n≤100000, elements are in 1..1000000000, and duplicates are allowed.

输出格式

Output a single integer answer.

样例 1

输入:

3
1 2 3
1 2 1

输出:

2

样例 2

输入:

5
1 2 3 4 5
6 6 1 1 1

输出:

3

样例 3

输入:

3
2 3 3
3 4 5

输出:

0

样例说明

The outputs of the three public examples are, in order: 2; 3; 0. These answers have been checked by independent enumeration or direct simulation.