#abc337c. C - Lining Up 2
C - Lining Up 2
Score: points
问题描述
有 名人员站成一排:第 1 号人员、第 2 号人员、……、第 号人员。
你得到的人员排列顺序是一个长度为 的序列 。
其中, 表示如下信息:
- 若 ,表示第 号人员站在队伍的最前面;
- 若 ,表示第 号人员紧跟在第 号人员后面。
请按照从前到后的顺序输出队伍中人员的编号。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
There are people standing in a line: person , person , , person .
You are given the arrangement of the people as a sequence of length .
represents the following information:
- if , person is at the front of the line;
- if , person is right behind person .
Print the people's numbers in the line from front to back.
Constraints
- or
- There is exactly one way to arrange the people consistent with the information given.
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
If person , person , , person are standing in the line in this order, print , , , and in this order, separated by spaces.
Sample Input 1
6
4 1 -1 5 3 2
Sample Output 1
3 5 4 1 2 6
If person , person , person , person , person , and person stand in line in this order from front to back, the arrangement matches the given information.
Indeed, it can be seen that:
- person is standing right behind person ,
- person is standing right behind person ,
- person is at the front of the line,
- person is standing right behind person ,
- person is standing right behind person , and
- person is standing right behind person .
Thus, print , , , , , and in this order, separated by spaces.
Sample Input 2
10
-1 1 2 3 4 5 6 7 8 9
Sample Output 2
1 2 3 4 5 6 7 8 9 10
Sample Input 3
30
3 25 20 6 18 12 26 1 29 -1 21 17 23 9 8 30 10 15 22 27 4 13 5 11 16 24 28 2 19 7
Sample Output 3
10 17 12 6 4 21 11 24 26 7 30 16 25 2 28 27 20 3 1 8 15 18 5 23 13 22 19 29 9 14
update @ 2024/3/10 01:27:17