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

建议使用的浏览器:

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

4053:The Last Puzzle

Special Judge 特殊评判
题目描述
There is one last gate between the hero and the dragon. But opening the gate isn't an easy task.

There were n buttons list in a straight line in front of the gate and each with an integer on it. Like other puzzles the hero had solved before, if all buttons had been pressed
down in any moment, the gate would open. So, in order to solve the puzzle, the hero must press all the button one by one.

After some trials, the hero found that those buttons he had pressed down would pop up after a while before he could press all the buttons down. He soon realized that
the integer on the button is the time when the button would automatic pop up after pressing it, in units of second. And he measured the distance between every button
and the first button, in units of maximum distance the hero could reach per second. Even with this information, the hero could not figure out in what order he should
press the buttons. So you talent programmers, are assigned to help him solve the puzzle.

To make the puzzle easier, assuming that the hero always took integral seconds to go from one button to another button and he took no time turnning around or pressing
a button down. And the hero could begin from any button.
输入解释
The input file would contain multiple cases. Each case contains three lines. Process to the end of file.

The first line contains a single integer n(1 ≤ n ≤200), the number of buttons.

The second line contains n integers T1, T2, ..., Tn, where Ti(1 ≤ Ti ≤ 1,000,000) is the time the ith button would automatic pop up after pressing it, in units of second.

The third line contains n integers D1, D2, ..., Dn, where Di(1 ≤ Di ≤ 1,000,000) is the time hero needed to go between the ith button and the first button, in units of second.
The sequence will be in ascending order and the first element is always 0.
输出解释
Output a single line containing n integers which is the sequence of button to press by the hero. If there are multiply sequences, anyone will do. If there is no way for the
hero to solve the puzzle, just output "Mission Impossible"(without quote) in a single line.
输入样例
2
4 3
0 3
2
3 3
0 3
4
5 200 1 2
0 1 2 3
输出样例
1 2
Mission Impossible
1 2 4 3

提示
In the second sample, no matter which button the hero pressed first, the button would always pop up before he press the other button. So there is no way to make all
 the button pressed down.
来自杭电HDUOJ的附加信息
Author WANG, Yelei
Recommend lcy

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

源链接: HDU-4053

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

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)