#P13796. [SWERC 2023] Nicest view
[SWERC 2023] Nicest view
题目描述
:::align{center}
:::
Paris is so crowded with tourists during the Olympic games! You want to escape the city and go on a hike on a linear trail path, going from left to right. Every kilometre on that trail, including at start and end, is a milestone, on which is written the stone's altitude. The slope between two consecutive stones is constant, and no two stones have the same altitude.
Planning to come back with your friends, you try to identify the point of the hike at which you had the nicest view. The beauty of a point of view is defined as the distance (measured in kilometres) between your position and the leftmost position that you can see on your hike and that is at the same altitude as you are. If such a previous position fails to exist, it means that you can see the city and its smog, and the beauty of that view is zero.
You have listed the altitudes of the milestones. What is the maximal beauty on your hike?
输入格式
The input consists of two lines. The first line contains a single integer , which is the number of milestones on the trail path. The second line contains space-separated integers ; each integer is the altitude (measured in metres) of the milestone on the path.
Limits
- ;
- for all ;
- the integers are pairwise distinct.
输出格式
The output should contain a single line, consisting of a single number : the best beauty score on your hike. This number is written either as an integer or as an irreducible fraction for which ; we recall that a fraction is irreducible when the greatest common divisor of and is .
7
0 5 3 1 4 8 2
13/4
5
3 5 8 7 1
0