#abc240d. D - Strange Balls
D - Strange Balls
Score : points
问题描述
Takahashi 有 个球。每个球上都写着一个不小于 的整数。他将逐个将它们放入一个圆柱体中。第 个球上写的整数是 。
这些球是由特殊材料制成的。当有 个写有数字 的球排成一排时,这 个球都会消失。
对于每个 ,计算插入第 个球后剩余的球的数量。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Takahashi has balls. Each ball has an integer not less than written on it. He will insert them in a cylinder one by one. The integer written on the -th ball is .
The balls are made of special material. When balls with written on them line up in a row, all these balls will disappear.
For each , find the number of balls after inserting the -th ball.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the number of balls after inserting the -th ball.
Sample Input 1
5
3 2 3 2 2
Sample Output 1
1
2
3
4
3
The content of the cylinder changes as follows.
- After inserting the -st ball, the cylinder contains the ball with .
- After inserting the -nd ball, the cylinder contains from bottom to top.
- After inserting the -rd ball, the cylinder contains from bottom to top.
- After inserting the -th ball, the cylinder contains from bottom to top.
- After inserting the -th ball, the cylinder momentarily has from bottom to top. The two consecutive balls with disappear, and the cylinder eventually contains from bottom to top.
Sample Input 2
10
2 3 2 3 3 3 2 3 3 2
Sample Output 2
1
2
3
4
5
3
2
3
1
0
update @ 2024/3/10 10:20:52