#P9780. [HUSTFC 2023] Azur Lane
[HUSTFC 2023] Azur Lane
Problem Description
You are a commander in the port area. You can strengthen your fleet by training “Commander Meowfficer”, which are trained from the corresponding “Meow Boxes”. Meow Boxes have levels; the higher the level, the rarer it is. Every day you will obtain some Meow Boxes (at least one), and then use “One-click Insert” to put these Meow Boxes into the “Meow Nest” for training. “One-click Insert” will put rarer Meow Boxes first (that is, after sorting by rarity from high to low, insert them one by one). The inserted Meow Boxes will be placed after the boxes that are already in the nest. At the end of each day, the system will automatically deduct an amount of money equal to the number of Meow Boxes currently in the Meow Nest. At the beginning, there are no Meow Boxes in your Meow Nest.
Because you are very lazy, you will wait until after days to open all the Meow Boxes together. When you enter the Meow Nest after days, you see Meow Boxes. Use a sequence of length to represent the levels of the Meow Boxes in the Meow Nest, ordered by the time they were inserted. However, you have already forgotten how many Meow Boxes you obtained each day during these days, and you even forgot what was. Clearly, there are many possible situations. You want to know: for every integer satisfying , among all possible situations, what is the minimum total amount of money that could have been deducted over these days?
Input Format
The first line contains two integers and , representing the number of Meow Boxes in the Meow Nest and the maximum level of Meow Boxes, respectively.
The second line contains integers , representing the levels of the Meow Boxes arranged in the Meow Nest.
Output Format
Output one line with integers separated by spaces. The -th integer represents, when , the minimum total amount of money that could be deducted among all possible situations. If there is no valid situation, output .
3 3
2 3 1
-1 4 6
8 4
3 2 4 2 1 2 3 2
-1 -1 -1 21 22 25 29 36
Hint
Explanation for Sample 1:
When , it is impossible to obtain these Meow Boxes within one day (the level of the second Meow Box is greater than the level of the first Meow Box, which does not follow the rule that “One-click Insert” inserts from high to low), so output .
When , on the first day you obtain the first Meow Box; at this time there is Meow Box in the Meow Nest, so the cost for that day is . On the second day you obtain the last two Meow Boxes; at this time there are Meow Boxes in the Meow Nest, so the cost for that day is . Therefore, the total amount of money is .
When , each day you obtain one Meow Box in order, and the total amount of money is .
Translated by ChatGPT 5