Histogram Sequence 3

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

Consider the histogram composed of nn squares with side lengths a_1,a_2,,a_na\_1, a\_2, \cdots, a\_n. Let's call the sequence (a_1,a_2,,a_n)(a\_1, a\_2, \cdots, a\_n) the histogram sequence of this histogram.

Let's consider the height of each column in this histogram. The first a_1a\_1 columns will each have height a_1a\_1, the following a_2a\_2 columns will each have height a_2a\_2, ... and the last a_na\_n columns will each have height a_na\_n. Now, let us define the height sequence (b_1,b_2,,b_a_1+a_2++a_n)(b\_1, b\_2, \cdots, b\_{a\_1 + a\_2 + \cdots + a\_n}) where b_j (1ja_1+a_2++a_n)b\_j\ (1 \le j \le a\_1+a\_2+\cdots+a\_n) is the height of the jj-th column.

For example, the histogram with (3,2,1,4)(3, 2, 1, 4) as its histogram sequence has (3,3,3,2,2,1,4,4,4,4)(3, 3, 3, 2, 2, 1, 4, 4, 4, 4) as its height sequence.

Write a program to find the histogram sequence given the height sequence.

입력

The first line contains a single integer m (1m106)m\ (1 \le m \le 10^6) representing the length of the height sequence b_i\\{b\_i\\} is given.

The second line of the input contains mm integers, the height sequence. Specifically, the ii-th integer in the line is b_i (1b_im)b\_i\ (1 \le b\_i \le m).

The input is designed such that the provided height sequence corresponds to a valid histogram sequence.

출력

Output nn integers on a single line, a_1,a_2,,a_na\_1, a\_2, \cdots, a\_n where (a_1,a_2,,a_n)(a\_1, a\_2, \cdots, a\_n) is the histogram sequence corresponding to the given height sequence. If there are multiple answers, any one of them will be accepted.