logo AlgoBeat OnlineJudge
登录 注册

#216402. [SYSUCPC 2025] Abacus

内存限制:128 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

There is a special abacus lying flat on the table with a total of vertical rods. Each vertical rod has some beads, forming a total of rows. The -th row from the top contains beads, where is a positive integer not exceeding . Adjacent rows on a vertical rod may not necessarily both have beads. Now, the abacus is stood upright, and all beads fall naturally. Determine the number of beads in each row after the beads have fallen. It can be proved that there are still rows after the beads fall.

The process for the first sample case is as follows:

:::align{center} :::

输入格式

The first line contains two integers and .

The next line contains integers . It is guaranteed that for all .

输出格式

The only line contains integers represent the beads in each row after the process.

样例

样例输入 1

4 6
4 2 6 3

样例输出 1

2 3 4 6

样例输入 2

7 10
3 6 6 4 3 1 5

样例输出 2

1 3 3 4 5 6 6