cswork / OA打开练习工作台

AmazonOA #204

Get Maximum Pairs

估计中等可在线判题

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

Each of two groups has n servers, and each server can be used at most once. Pair them freely; only pairs whose front-end quality is strictly greater than the back-end quality count. Find the maximum number of pairs.

输入格式

The first line contains n, the second line the front-end qualities, and the third line the back-end qualities. This site uses 1≤n≤100000, 1≤quality≤10^9.

输出格式

Output a single integer, the answer.

样例 1

输入:

3
3 1 5
2 2 4

输出:

2

样例 2

输入:

2
2 2
2 2

输出:

0

样例 3

输入:

1
10
1

输出:

1

样例说明

The answers are 2, 0 and 1; ties do not count as wins.