[POI2011] Lightning Conductor
题意翻译
给定一个长度为 $n$ 的序列 $\{a_n\}$,对于每个 $i\in [1,n]$ ,求出一个最小的非负整数 $p$ ,使得 $\forall j\in[1,n]$,都有 $a_j\le a_i+p-\sqrt{|i-j|}$
$1 \le n \le 5\times 10^{5}$,$0 \le a_i \le 10^{9}$ 。
题目描述
Progressive climate change has forced the Byteburg authorities to build a huge lightning conductor that would protect all the buildings within the city.
These buildings form a row along a single street, and are numbered from ![](http://main.edu.pl/images/OI18/pio-en-tex.1.png) to ![](http://main.edu.pl/images/OI18/pio-en-tex.2.png).
The heights of the buildings and the lightning conductor are non-negative integers.
Byteburg's limited funds allow construction of only a single lightning conductor.
Moreover, as you would expect, the higher it will be, the more expensive.
The lightning conductor of height ![](http://main.edu.pl/images/OI18/pio-en-tex.3.png) located on the roof of the building ![](http://main.edu.pl/images/OI18/pio-en-tex.4.png) (of height ![](http://main.edu.pl/images/OI18/pio-en-tex.5.png)) protects the building ![](http://main.edu.pl/images/OI18/pio-en-tex.6.png) (of height ![](http://main.edu.pl/images/OI18/pio-en-tex.7.png)) if the following inequality holds:
![](http://main.edu.pl/images/OI18/pio-en-tex.8.png) where ![](http://main.edu.pl/images/OI18/pio-en-tex.9.png) denotes the absolute value of the difference between ![](http://main.edu.pl/images/OI18/pio-en-tex.10.png) and ![](http://main.edu.pl/images/OI18/pio-en-tex.11.png).
Byteasar, the mayor of Byteburg, asks your help.
Write a program that, for every building ![](http://main.edu.pl/images/OI18/pio-en-tex.12.png), determines the minimum height of a lightning conductor that would protect all the buildings if it were put on top of the building ![](http://main.edu.pl/images/OI18/pio-en-tex.13.png).
输入输出格式
输入格式
In the first line of the standard input there is a single integer ![](http://main.edu.pl/images/OI18/pio-en-tex.14.png) (![](http://main.edu.pl/images/OI18/pio-en-tex.15.png)) that denotes the number of buildings in Byteburg.
Each of the following ![](http://main.edu.pl/images/OI18/pio-en-tex.16.png) lines holds a single integer ![](http://main.edu.pl/images/OI18/pio-en-tex.17.png) (![](http://main.edu.pl/images/OI18/pio-en-tex.18.png)) that denotes the height of the ![](http://main.edu.pl/images/OI18/pio-en-tex.19.png)-th building.
输出格式
Your program should print out exactly ![](http://main.edu.pl/images/OI18/pio-en-tex.20.png) lines to the standard output.
The ![](http://main.edu.pl/images/OI18/pio-en-tex.21.png)-th line should give a non-negative integer ![](http://main.edu.pl/images/OI18/pio-en-tex.22.png) denoting the minimum height of the lightning conductor on the ![](http://main.edu.pl/images/OI18/pio-en-tex.23.png)-th building.
输入输出样例
输入样例 #1
6
5
3
2
4
2
4
输出样例 #1
2
3
5
3
5
4