cswork / OA打开练习工作台

Akuna CapitalOA #3

Update Release Scheduler

估计中等可在线判题

考点(AI 标注)贪心调度

Release updates in non-decreasing order of plannedDate. Each update may use either alternateDate or plannedDate, and several updates may be released on the same day. Minimize the calendar day on which all updates are complete. Updates with equal plannedDate may be released in any order among themselves; the optimal choice is to process them in increasing alternateDate.

输入格式

The first line contains n; the second line contains n plannedDate values; the third line contains n alternateDate values. Original constraints: 1≤n≤200000, 1≤(elements of both arrays)≤10^9, alternateDate[i]≤plannedDate[i].

输出格式

Output the earliest completion day after all updates are released.

样例 1

输入:

4
3 7 4 9
1 5 2 3

输出:

9

样例 2

输入:

3
9 2 7
1 1 1

输出:

1

样例 3

输入:

4
3 2 7 8
1 1 5 6

输出:

6

题解

正在加载题解…