#P5503. [JSOI2016] 灯塔
[JSOI2016] 灯塔
Problem Description
Along the border of JSOI, there are consecutive mountain peaks. The height of the -th peak is . For simplicity, we assume these peaks are arranged along a straight line.
If a lighthouse of height () is built on the -th peak, JYY finds that this lighthouse can illuminate the -th peak if and only if the following inequality holds:
The king of JSOI wants JYY to provide, for each peak, the minimum height required to build a lighthouse that can illuminate all other peaks. Can you help JYY?
Input Format
The input contains one line with a positive integer .
In the next lines, the -th line contains a positive integer , representing the height of the -th peak.
Output Format
The -th line contains a non-negative integer, representing the minimum height required to build a lighthouse on the -th peak.
6
5
3
2
4
2
4
2
3
5
3
5
4
Hint
For of the data, , .
Translated by ChatGPT 5