当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6752:Boring Task

题目描述
You are given N tasks numbered from 1 to N and a single machine able to process the tasks. At any time, the machine can only process a single task.

For every integer i between 1 and N, you are given 2 integers - $T_i$, denoting when the $i^{th}$ task is created, that means you can only process the $i^{th}$ task not earlier than $T_i$, and $D_i$, denoting the period of time the machine takes to completely process the $i^{th}$ task.

All the tasks are individual, so you can assign tasks in any order. Also, if the machine starts to process a task, then it never stops working until the task is finished. The machine can immediately start the other task (obviously, this task should be available) after finishing a task.

The waiting time, for the $i^{th}$ task, is defined as the delay time of the task that is equal to the difference between the time when the machine starts to process the $i^{th}$ task and $T_i$. You want to minimize the maximum waiting time of the given tasks. Find the minimum value of maximum waiting time.
输入解释
The first line of the input contains a single integer T (1≤T≤1 200), the number of test cases. Each test case consists of 3 lines.

The first line of each test case contains a single integer N (1≤N≤$2 \cdot {10^5}$), the number of tasks. The next line contains N integers $T_i$ (1≤$T_i$≤$2 \cdot {10^{14}}$), the earliest time the $i^{th}$ task can be processed. The $3^{rd}$ line N integers $D_i$ (1≤$D_i$≤$10^9$), the period of time the machine takes to finish the $i^{th}$ task. It’s guaranteed that the sum of N over all test cases doesn’t exceed 2 500 000.
输出解释
For each test case, you should print the minimum possible value of the maximum waiting time.
输入样例
2
3
1 3 2
1 1 1
3
1 3 2
3 2 1
输出样例
0
2
来自杭电HDUOJ的附加信息
Recommend liuyiding

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6752

最后修改于 2020-10-25T23:34:03+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
10000/5000MS(Java/Others) 524288/524288K(Java/Others)