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

建议使用的浏览器:

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

BZOJ3830:[Poi2014]Freight

题目描述
The train stations in Upper Bytown and Lower Bytown are connected with a single track rail link. It takes the train   minutes to travel between them in either direction. However, the trains departing a station have to be spaced at least one minute apart. Moreover, at all times, all the trains on the rail link have to go in the same direction.
According to the timetable at our disposal,   cargo trains destined for Lower Bytown are to pass through the Upper Bytown. They are to be loaded with goods in Lower Bytown and then return to Upper Bytown. For simplicity, we assume that loading the goods on the train takes virtually no time.
We are to determine the minimum possible time of the last train returning to Upper Bytown.
Upper Bytown和Lower Bytown的火车站被一条铁路连接着。火车从一侧到另一侧需要S分钟。然而,每两列车发车时间至少需要间隔一分钟。并且,在每一个时刻,在铁路上的所有列车的行驶方向都必须相同。
按照时间表的顺序,N辆列车将从Upper Bytown出发前往Lower Bytown,到达后又需要回到Upper Bytown。
请计算最迟回到Upper Bytown的列车回到Upper Bytown的时刻的最小值。

输入解释
The first line of the standard input contains two integers N,S(1<=N<=1 000 000,1<=S<=10^9) , separated by a single space, that specify the number of trains and the one-way travel time respectively. The second line contains   integers T1,T2…Tn(0<=T1<=T2..<=Tn<=10^9) , separated by a single space, that specify the arrival times of successive trains at the Upper Bytown station.

输出解释
Your program should print out a single line with a single integer to the standard output: the minimum possible time of the last train returning to Upper Bytown.

输入样例
3 4
1 8 11
输出样例
20

该题目包含在题集 大视野(八中)OJ 中

题目来源 BZOJ 3830

源链接: LOCAL-BZOJ3830

共提交 0 次

通过率 --%
时间上限 内存上限
20000 MS 64 MB