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

建议使用的浏览器:

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

1967:Alibaba

题目描述
Alibaba the famous character of our childhood stories would like to be immortal in order to keep bringing happiness to children. In order to rich this status he needs to prove that he is still able to do some unusual things. There are n treasures, (n<=10000) each in a different place located along a straight road.Each treasure has a time limit, after that it vanishes. Alibaba must take all the n treasures, and he must do it quickly. So he needs to figure out the order in which he should take the treasures before their deadlines starting from the most favorable position. Alibaba has the list of places and deadlines of the treasures.A place i is located at distance di from the leftmost end of the road. The time it takes to take a treasure is instantaneous. Alibaba must find the smallest time by which he can take all the treasures.
输入解释
Each data set in the input stands for a particular set of treasures. For each set of treasures the input contains the number of treasures, and the list of pairs place - deadline in increasing order of the locations. White spaces can occur freely between the numbers in the input.The input data are correct.
输出解释
For each set of data the program prints the result to the standard output on a separate line. The solution is represented by the smallest time by which Alibaba can take all the treasures before they vanish. If this is not possible then the output is "No solution".
输入样例
5
1 3
3 1
5 8
8 19
10 15

5
1 5
2 1
3 4
4 2
5 3
输出样例
11
No solution

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-1967

最后修改于 2020-10-29T06:19:11+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
5000 65536