#P8686. Unique Array Transformation

    ID: 21852 Type: Default 1000ms 256MiB

Unique Array Transformation

Unique Array Transformation

Given an array \( A = [A_1, A_2, \ldots, A_N] \) of length \( N \), where the array may contain duplicate integers, modify the array so that all elements become unique. The transformation is performed sequentially starting from \( A_2 \) through \( A_N \). For each \( A_i \) (\( 2 \leq i \leq N \)), if \( A_i \) appears in the subarray \( A_1, A_2, \ldots, A_{i-1} \), then continuously increment \( A_i \) by \( 1 \) until it becomes a value that has not appeared in \( A_1, A_2, \ldots, A_{i-1} \). Output the final modified array.

Note: All formulas are represented in LaTeX format.

inputFormat

The first line of input contains an integer \( N \) representing the number of elements in the array. The second line contains \( N \) space-separated integers representing the array \( A \).

outputFormat

Output a single line containing the modified array of \( N \) unique integers, separated by spaces.

sample

3
1 1 1
1 2 3