/
実行時間制限: 2 sec / メモリ制限: 1024 MiB
配点 : 300 点
問題文
高橋先生は、今日 N 人の生徒から宿題を受け取る予定です。
高橋先生は効率的に宿題をチェックするため、生徒を特定の順番で呼んで宿題を提出させることにしました。各生徒には 1 から N までの出席番号が割り当てられており、出席番号 i の生徒は A_i ページ分の宿題を提出します。
高橋先生は、提出するページ数が少ない生徒から順に(ページ数の昇順に)呼び出したいと考えています。ページ数が同じ生徒が複数いる場合は、出席番号が小さい生徒を先に呼び出します。
高橋先生が生徒を呼び出す順番を求めてください。
制約
- 1 \leq N \leq 2 \times 10^5
- 1 \leq A_i \leq 10^9
- 入力はすべて整数
入力
N A_1 A_2 \ldots A_N
- 1 行目には、生徒の人数を表す整数 N が与えられる。
- 2 行目には、各生徒が提出する宿題のページ数を表す N 個の整数 A_1, A_2, \ldots, A_N がスペース区切りで与えられる。ここで A_i は出席番号 i の生徒が提出する宿題のページ数である。
出力
生徒を呼び出す順番に、N 人の出席番号をスペース区切りで 1 行で出力せよ。
入力例 1
5 30 10 20 10 40
出力例 1
2 4 3 1 5
入力例 2
8 100 50 50 75 25 100 25 50
出力例 2
5 7 2 3 8 4 1 6
入力例 3
12 1000000000 1 500 500 999999999 1 250 750 500 1000000000 250 1
出力例 3
2 6 12 7 11 3 4 9 8 5 1 10
Score : 300 pts
Problem Statement
Takahashi-sensei is scheduled to receive homework from N students today.
To check the homework efficiently, Takahashi-sensei decided to call students in a specific order to submit their homework. Each student is assigned an attendance number from 1 to N, and the student with attendance number i submits A_i pages of homework.
Takahashi-sensei wants to call students in ascending order of the number of pages they submit (students with fewer pages first). If multiple students have the same number of pages, the student with the smaller attendance number is called first.
Determine the order in which Takahashi-sensei calls the students.
Constraints
- 1 \leq N \leq 2 \times 10^5
- 1 \leq A_i \leq 10^9
- All inputs are integers
Input
N A_1 A_2 \ldots A_N
- The first line contains an integer N representing the number of students.
- The second line contains N integers A_1, A_2, \ldots, A_N separated by spaces, representing the number of pages of homework each student submits. Here, A_i is the number of pages of homework submitted by the student with attendance number i.
Output
Print the attendance numbers of the N students in the order they are called, separated by spaces, on a single line.
Sample Input 1
5 30 10 20 10 40
Sample Output 1
2 4 3 1 5
Sample Input 2
8 100 50 50 75 25 100 25 50
Sample Output 2
5 7 2 3 8 4 1 6
Sample Input 3
12 1000000000 1 500 500 999999999 1 250 750 500 1000000000 250 1
Sample Output 3
2 6 12 7 11 3 4 9 8 5 1 10