413 传统题

[ABC240D] 奇异球筒 (Strange Balls)

时间限制
2000ms
内存限制
1024MiB
登顶 / 尝试
1/ 1
难度
3

[ABC240D] 奇异球筒 (Strange Balls)

Score : 400 points Problem Statement Takahashi has N balls. Each ball has an integer not less than 2 written on it. He will insert them in a cylinder one by one. The integer written on the i-th ball is a_i. The balls are made of special material. When k balls with k (k \geq 2) written on them line up in a row, all these k balls will disappear. For each i (1 \leq i \leq N), find the number of balls after inserting the i-th ball. Constraints 1 \leq N \leq 2 \times 10^5 2 \leq a_i \leq 2 \times 10^5 , (1 \leq i \leq N) All values in input are integers. Input Input is given from Standard Input in the following format: N a_1 \ldots a_N Output Print N lines. The i-th line (1 \leq i \leq N) should contain the number of balls after inserting the i-th ball.