AmazonOA #100
Buy Volumes (Order Books :)
估计简单可在线判题
考点(AI 标注)模拟/实现哈希计数
volumes is a permutation of 1..n, and on day i that volume arrives. Each day, buy as many new volumes as possible; before buying a volume you must already own every smaller volume number, and several volumes may be bought one after another on the same day. Output the volume numbers bought each day; if nothing is bought, output −1.
输入格式
The first line contains n (1..100000), and the second line contains the permutation volumes of 1..n.
输出格式
Output n lines; each line lists the volume numbers bought that day in ascending order, or −1 alone.
样例 1
输入:
4
2 1 4 3
输出:
-1
1 2
-1
3 4
样例 2
输入:
5
1 4 3 2 5
输出:
1
-1
-1
2 3 4
5
样例 3
输入:
3
1 2 3
输出:
1
2
3
样例说明
Example 1: output −1; 1 2; −1; 3 4 in order. Example 2: buy 1 on the first day, wait on the second and third days, buy 2 3 4 on day 4, and buy 5 on the last day. Example 3: the arrival order is already ascending, so each day buys that day's volume.