cswork / OA打开练习工作台

DoorDashOA #6

Maximize Total Profit by Assigning Chefs to Dishes

估计中等可在线判题

考点(AI 标注)贪心调度二分查找

Each chef makes at most one dish, and a dish can be chosen by several chefs; a chef can only make dishes whose difficulty ≤ the chef's skill, and each chef chooses the highest profit among the dishes they can make. If a chef can make no dish, the profit is 0.

输入格式

n (1..200000) and n skill values; m (1..200000), m difficulties, and m profits; all values are 0..10⁹. This site adopts the typical limits given by the original problem.

输出格式

Output the total profit (64-bit).

样例 1

输入:

3
1 2 3
3
1 2 3
1 2 3

输出:

6

样例 2

输入:

2
0 1
2
2 0
100 7

输出:

14

样例 3

输入:

2
2 2
2
1 3
8 99

输出:

16