atcoder#TOKIOMARINE2020C. Lamps
Lamps
Score : points
Problem Statement
We have bulbs arranged on a number line, numbered to from left to right. Bulb is at coordinate .
Each bulb has a non-negative integer parameter called intensity. When there is a bulb of intensity at coordinate , the bulb illuminates the segment from coordinate to . Initially, the intensity of Bulb is . We will now do the following operation times in a row:
- For each integer between and (inclusive), let be the number of bulbs illuminating coordinate . Then, change the intensity of each bulb to .
Find the intensity of each bulb after the operations.
Constraints
Input
Input is given from Standard Input in the following format:
Output
Print the intensity of each bulb after the operations to Standard Output in the following format:
5 1
1 0 0 1 0
1 2 2 1 2
Initially, only Bulb illuminates coordinate , so the intensity of Bulb becomes after the operation. Similarly, the bulbs initially illuminating coordinate are Bulb and , so the intensity of Bulb becomes .
5 2
1 0 0 1 0
3 3 4 4 3