Problem D
Bungee Builder
A new bungee jumping attraction is to be built at a mountain
range of
Once the bridge is built, the attraction will be opened at some point along it. The jumping distance is limited by the vertical distance of the attraction from the ground directly below. In order to achieve the greatest level of excitement, the bridge should be built to maximise the distance of the furthest point from the ground.
Consider the following example:
![\includegraphics[width=0.8\textwidth ]{example.png}](/problems/bungeebuilder/file/statement/en/img-0001.png)
The optimal bridge is denoted by the solid red line and the jumping distance is denoted by the dotted red line.
Your task is to determine the maximum jumping distance achievable. If no bridge can be built, the distance is zero.
Input
The first line contains an integer
Output
The maximum jumping distance possible.
Subtasks
-
(25 Points):
-
(50 Points):
-
(25 Points): No additional constraint
Sample Input 1 | Sample Output 1 |
---|---|
10 3 5 1 4 2 3 7 2 2 5 |
4 |