SalesforceOA #18
Get Minimum Development Time
估计中等可在线判题
Each feature is handled in exactly one of two ways: development takes developmentTime[i], and integration takes integrationTime[i]. Development is carried out simultaneously by as many members as needed, while integration is done sequentially by the team lead alone; the two kinds of work may overlap. Find the shortest time to finish everything. The parallel/serial conditions were recovered from the original HTML.
输入格式
The first line contains n, followed by two lines giving the development times and the integration times respectively. On this site 1≤n≤200000, and both kinds of times are in 1..10⁹.
输出格式
Output the shortest schedule length. The intermediate sum of integration times requires 64 bits.
样例 1
输入:
5
10 12 13 8 15
1 2 1 1 1
输出:
6
样例 2
输入:
2
2 100
100 3
输出:
3
样例 3
输入:
1
1
100
输出:
1
样例说明
The answers are 6, 3, and 1; in the second example, development and integration run in parallel, so 2 and 3 must not be added.