#C10374. Final Tree Heights

    ID: 39572 Type: Default 1000ms 256MiB

Final Tree Heights

Final Tree Heights

You are given N trees with their initial heights. Over K days, each tree grows according to the following rule. On each day, the new height of the i-th tree becomes the maximum height among all trees whose indices lie in the interval ([\max(0, i-L), \min(N-1, i+L)]). Mathematically, if (h_i^{(d)}) represents the height of the i-th tree on day d, then for each day (d \ge 0) and for every tree index (i), the new height is given by: [ h_i^{(d+1)} = \max_{j=\max(0,i-L)}^{\min(N-1,i+L)} h_j^{(d)} ]

Your task is to simulate this process for K days and output the final heights of all trees.

inputFormat

The first line contains three integers: N, K, and L. The second line contains N integers representing the initial heights of the trees.

outputFormat

Print N integers separated by a single space, representing the final heights of the trees after K days.## sample

5 2 1
1 2 3 2 1
3 3 3 3 3

</p>