#P9429. [NAPC-#1] Stage1 - Simple
[NAPC-#1] Stage1 - Simple
Background
Problem Description
Brief Statement
Given , construct an integer sequence of length such that:
- (each element of is at least and at most ).
- (for every two adjacent elements in , the absolute difference is at most ).
- (the sum of all elements in is ).
A solution is guaranteed to exist.
Original Statement
I forgot what happened before, but you followed kid and traveled to ic (I wanna be the Creator) and arrived in front of a level editor. The map has width and height , and you cannot change these. There are also unplaced bricks. Now you need to help kid place them, meaning: place these bricks so that kid can pass. The requirements are:
Bricks have gravity, so a brick can only be placed on the bottom boundary or on top of another brick. You cannot place multiple bricks at the same coordinate.- You must leave at least one gap for kid to pass, so in each column you can place at most bricks (since the map height is ). Note that in ic levels, the bottom boundary does not cause damage, so a column may also have no bricks.
- kid’s jumping ability and
the ability to fall from a height without getting hurtare limited, described by a non-negative integer : the absolute difference between the numbers of bricks placed in adjacent columns cannot exceed , otherwise the level is impossible for kid. ((But note: this rule does not restrict the height of the first column, since kid’s spawn point is in the first column.)) - You must place all bricks, no more and no less.
Creator will not make things difficult for you, so there is always a level that satisfies all the rules above.
For easier output, you only need to give how many bricks are in the -th column (denote it as ), i.e., output the sequence . It is easy to prove that a valid sequence corresponds one-to-one with a valid level.
Input Format
A single line with non-negative integers .
Output Format
Output one line with non-negative integers representing your constructed sequence . If there are multiple possible sequences, output any one that satisfies the requirements. It is guaranteed that at least one sequence satisfies the requirements.
4 6 2 11
2 4 2 3
3 4 5 6
4 2 0
Hint
Constraints
This problem has test points, equally weighted.
- For of the testdata, .
- For of the testdata, .
- For of the testdata, .
For of the testdata, , , .
Hint
In ancient times there was a number, its name was . can be so large that one
intmay (possibly) not hold it.
Sample Explanation #1
The level corresponding to the sample output is as follows.

Note that there may be multiple valid levels that meet the conditions.
Translated by ChatGPT 5
