#P2501. Transform to a Strictly Increasing Sequence

    ID: 15771 Type: Default 1000ms 256MiB

Transform to a Strictly Increasing Sequence

Transform to a Strictly Increasing Sequence

You are given an integer sequence of length (n) represented as (a_1, a_2, \dots, a_n). The sequence might not be strictly increasing and may look unappealing. Your task is to transform (a) into a strictly increasing sequence (b_1, b_2, \dots, b_n) by modifying as few elements as possible and keeping the changes as small as possible. In other words, you should obtain the sequence (b) such that: [ \begin{cases} b_1 = a_1, \ b_i = \max(a_i,,b_{i-1}+1) \quad \text{for } i \ge 2, \end{cases} ] which guarantees that (b_1 < b_2 < \cdots < b_n).

The final sequence (b) should be printed as a single line of space-separated integers.

inputFormat

The first line contains a single integer (n) ((1 \le n \le 10^5)), the number of elements in the sequence. The second line contains (n) space-separated integers (a_1, a_2, \dots, a_n) ((|a_i| \le 10^9)).

outputFormat

Output a single line containing (n) space-separated integers (b_1, b_2, \dots, b_n), representing the strictly increasing sequence obtained by the transformation.

sample

5
1 2 3 4 5
1 2 3 4 5