#P1392F. Omkar and Landslide
Omkar and Landslide
No submission language available for this problem.
Description
Omkar is standing at the foot of Celeste mountain. The summit is meters away from him, and he can see all of the mountains up to the summit, so for all he knows that the height of the mountain at the point meters away from himself is meters. It turns out that for all satisfying , (meaning that heights are strictly increasing).
Suddenly, a landslide occurs! While the landslide is occurring, the following occurs: every minute, if , then one square meter of dirt will slide from position to position , so that is decreased by and is increased by . These changes occur simultaneously, so for example, if and for some , then will be increased by , will be decreased by , and will be both increased and decreased by , meaning that in effect is unchanged during that minute.
The landslide ends when there is no such that . Help Omkar figure out what the values of will be after the landslide ends. It can be proven that under the given constraints, the landslide will always end in finitely many minutes.
Note that because of the large amount of input, it is recommended that your code uses fast IO.
The first line contains a single integer ().
The second line contains integers satisfying — the heights.
Output integers, where the -th integer is the value of after the landslide has stopped.
Input
The first line contains a single integer ().
The second line contains integers satisfying — the heights.
Output
Output integers, where the -th integer is the value of after the landslide has stopped.
Samples
Note
Initially, the mountain has heights .
In the first minute, we have , so increases to and decreases to , leaving .
In the second minute, we have and , so increases to , is unchanged, and decreases to , leaving .
In the third minute, we have , so increases to and decreases to , leaving .
In the fourth minute, we have , so increases to and decreases to , leaving .
In the fifth minute, we have , so increases to and decreases to , leaving .
In the sixth minute, nothing else can change so the landslide stops and our answer is .