#abc358b. B - Ticket Counter
B - Ticket Counter
Score : points
问题陈述
在AtCoder Land的入口处,有一个单独的售票亭,游客们会排队依次购买门票。购买过程每人需要秒。一旦队伍前面的人完成购票,下一个人(如果有的话)会立即开始他们的购买过程。
目前,售票亭前没有人排队,将会有人依次来购买门票。具体来说,第个人将在从现在开始的秒后到达售票亭。如果已经有队伍,他们会加入队伍的末尾;如果没有,他们将立即开始购买过程。这里,。
对于每个,确定从现在开始第个人完成购票需要多少秒。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
At the entrance of AtCoder Land, there is a single ticket booth where visitors line up to purchase tickets one by one. The purchasing process takes seconds per person. Once the person at the front of the line finishes purchasing their ticket, the next person (if any) immediately starts their purchasing process.
Currently, there is no one in line at the ticket booth, and people will come to buy tickets one after another. Specifically, the -th person will arrive at the ticket booth seconds from now. If there is already a line, they will join the end of it; if not, they will start the purchasing process immediately. Here, .
For each , determine how many seconds from now the -th person will finish purchasing their ticket.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the number of seconds from now that the -th person will finish purchasing their ticket.
Sample Input 1
3 4
0 2 10
Sample Output 1
4
8
14
The events proceed in the following order:
- At seconds: The 1st person arrives at the ticket booth and starts the purchasing process.
- At seconds: The 2nd person arrives at the ticket booth and joins the line behind the 1st person.
- At seconds: The 1st person finishes purchasing their ticket, and the 2nd person starts the purchasing process.
- At seconds: The 2nd person finishes purchasing their ticket.
- At seconds: The 3rd person arrives at the ticket booth and starts the purchasing process.
- At seconds: The 3rd person finishes purchasing their ticket.
Sample Input 2
3 3
1 4 7
Sample Output 2
4
7
10
The events proceed in the following order:
- At second: The 1st person arrives at the ticket booth and starts the purchasing process.
- At seconds: The 1st person finishes purchasing their ticket, and the 2nd person arrives at the ticket booth and starts the purchasing process.
- At seconds: The 2nd person finishes purchasing their ticket, and the 3rd person arrives at the ticket booth and starts the purchasing process.
- At seconds: The 3rd person finishes purchasing their ticket.
Sample Input 3
10 50000
120190 165111 196897 456895 540000 552614 561627 743796 757613 991216
Sample Output 3
170190
220190
270190
506895
590000
640000
690000
793796
843796
1041216