407216: GYM102697 187 Mountain Biking

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

187. Mountain Bikingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output
This problem is worth 20 points.

You just went on a very hilly bike ride, and you want to find largest hill that you biked up during your ride.

You know the elevations of several points along your ride, and you want to find the vertical rise of the largest continously uphill section of the ride. A continuously uphill section must have a positive overall vertical rise, and must consist of only uphill segments. If a section of the ride has any downhill or flat subsections, it is not considered a continuously uphill section.

Input

The first line of input contains a single positive integer $$$n$$$: the number of points along the ride that you know the elevations for.

The next line contains $$$n$$$ space-separated integers: the elevation, along each point of the ride.

Output

Output a single positive integer $$$v$$$: the value of the biggest hill on the ride, defined as the vertical rise of the largest continiously uphill section, as defined above. There is guaranteed to be at least one continously uphill section in the route given in the input.

ExamplesInput
7
600 650 700 690 740 520 600
Output
100
Input
5
400 500 600 700 400
Output
300
Input
8
100 200 300 300 400 500 600 700
Output
400

加入题单

算法标签: