Problem H
Hot Hike
Given the current forecast of daily maximum temperatures during your vacation, what are the best days for your trip?
Input
The first line of input contains an integer $n$ ($3 \le n \le 50$), the length of your vacation in days. Then follows a line containing $n$ integers $t_1, t_2, \ldots , t_ n$ ($-20 \le t_ i \le 40$), where $t_ i$ is the temperature forecast for the $i$’th day of your vacation.
Output
Output two integers $d$ and $t$, where $d$ is the best day to start your trip, and $t$ is the resulting maximum temperature during the two hiking days. If there are many choices of $d$ that minimize the value of $t$, then output the smallest such $d$.
Sample Input 1 | Sample Output 1 |
---|---|
5 23 27 31 28 30 |
2 28 |
Sample Input 2 | Sample Output 2 |
---|---|
4 30 20 20 30 |
1 30 |