Problem Statement
On a certain planet, there are $N$ aliens, all of whom are minors.
The $i$-th alien currently has $A_i$ stones, and will become an adult exactly $i$ years later.
When someone becomes an adult on this planet, every adult who has at least one stone gives exactly one stone as a congratulatory gift to the alien who has just become an adult.
Find how many stones each alien will have after $N$ years.
Assume that no new aliens will be born in the future.
Constraints
- $1 \leq N \leq 5 \times 10^5$
- $0 \leq A_i \leq 5 \times 10^5$
- All input values are integers.
Input
The input is given from Standard Input in the following format:
$N$ $A_1$ $A_2$ $\ldots$ $A_N$
Output
Let $B_i$ be the number of stones owned by the $i$-th alien after $N$ years. Print $B_1, B_2, \ldots, B_N$ in this order, separated by spaces.
Solving
|
|