Problem G
Svifdrekamaður
Languages
en
is

As everyone knows, the kiteman Sigurður Jens is famous for gliding between buildings. Despite being very talented he can not increase his height above the ground after the initial jump. Thus he always has to land at a lower height than where he started.
To prevent trouble and possible collisions Reykjavík has
established the rule that all buildings between the building
where he starts his flight and the building where he lands have
to be lower then both of the endpoints. That is to say,
Sigurður Jens may only fly from building
Sigurður Jens wants his show in Reykjavík to be as exciting as possible, but the excitement of a glide is defined as the distance the glide covers. He thus has to find the best two buildings to glide between. Out of all the buildings Sigurður Jens could choose, can you find out what the maximum excitement he can achieve is?
Input
The first line of the input contains one integer
Output
Print a single integer, the highest level of excitement
possible for a single show. If no shows are possible instead
print
Scoring
Group |
Points |
Constraints |
1 |
20 |
|
2 |
25 |
|
3 |
25 |
|
4 |
30 |
No further constraints |
Sample Input 1 | Sample Output 1 |
---|---|
1 20 |
0 |
Sample Input 2 | Sample Output 2 |
---|---|
10 8 12 6 18 4 10 18 7 8 16 |
3 |
Sample Input 3 | Sample Output 3 |
---|---|
10 9 1 2 3 4 5 6 7 8 10 |
9 |
Sample Input 4 | Sample Output 4 |
---|---|
8 8 7 6 5 4 3 2 1 |
1 |