CF767A.Snacktower
普及-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
According to an old legeng, a long time ago Ankh-Morpork residents did something wrong to miss Fortune, and she cursed them. She said that at some time n snacks of distinct sizes will fall on the city, and the residents should build a Snacktower of them by placing snacks one on another. Of course, big snacks should be at the bottom of the tower, while small snacks should be at the top.
Years passed, and once different snacks started to fall onto the city, and the residents began to build the Snacktower.

However, they faced some troubles. Each day exactly one snack fell onto the city, but their order was strange. So, at some days the residents weren't able to put the new stack on the top of the Snacktower: they had to wait until all the bigger snacks fell. Of course, in order to not to anger miss Fortune again, the residents placed each snack on the top of the tower immediately as they could do it.
Write a program that models the behavior of Ankh-Morpork residents.
根据一个古老的传说,很久以前,安克-莫波克的居民做了某件得罪幸运女神的事,于是她诅咒了他们。她说:在某个时刻,将有 n 个尺寸互不相同的零食落到这座城市上,居民们需将这些零食逐个堆叠起来,建造一座“零食塔”。当然,较大的零食应位于塔的底部,而较小的零食则应位于塔的顶部。
多年过去了,终于有一天,各种各样的零食开始陆续落到城市中,居民们也随即开始建造“零食塔”。

然而,他们遇到了一些麻烦。每天恰好有一个零食落到城市中,但这些零食落下的顺序却十分奇怪。因此,在某些日子里,居民们无法将新落下的零食直接放在“零食塔”的顶端——他们必须等待所有比它更大的零食都已落下之后,才能将其放置到位。当然,为了不再次激怒幸运女神,居民们一旦能够放置某个零食,便会立即将其置于塔的最顶端。
请编写一个程序,模拟安克-莫波克居民的这一行为。
输入格式
The first line contains single integer n (1 ≤ n ≤ 100 000) — the total number of snacks.
The second line contains n integers, the i-th of them equals the size of the snack which fell on the i-th day. Sizes are distinct integers from 1 to n.
第一行包含一个整数 n(1≤n≤100000)——零食的总数。
第二行包含 n 个整数,其中第 i 个数表示第 i 天掉落的零食的大小。这些大小是 1 到 n 之间互不相同的整数。
输出格式
Print n lines. On the i-th of them print the sizes of the snacks which the residents placed on the top of the Snacktower on the i-th day in the order they will do that. If no snack is placed on some day, leave the corresponding line empty.
输出 n 行。在第 i 行中,按居民将在第 i 天放置到零食塔顶部的顺序,输出当天所放置的零食的尺寸。如果某天没有放置任何零食,则对应行留空。
输入输出样例
输入#1
3 3 1 2
输出#1
3 2 1
输入#2
5 4 5 1 2 3
输出#2
5 4 3 2 1
说明/提示
In the example a snack of size 3 fell on the first day, and the residents immediately placed it. On the second day a snack of size 1 fell, and the residents weren't able to place it because they were missing the snack of size 2. On the third day a snack of size 2 fell, and the residents immediately placed it. Right after that they placed the snack of size 1 which had fallen before.
在示例中,第一天掉落了一个大小为 3 的零食,居民们立即将其放置好了。第二天掉落了一个大小为 1 的零食,但居民们无法将其放置,因为他们缺少大小为 2 的零食。第三天掉落了一个大小为 2 的零食,居民们立即将其放置好了;紧接着,他们便放置了之前掉落的大小为 1 的零食。
输入解题思路,AI测评打分。不知道怎么写?