C - Inverse Permutation
Editorial
/
Time Limit: 2 sec / Memory Limit: 1024 MB
問題文
長さ N の数列 (1, 2, 3, \ldots, N) を並べ替えて得られる数列 P = (P_1, P_2, \ldots, P_N) が与えられます。
K = 1, 2, \ldots, N のそれぞれについて、K が数列 P の何番目の要素であるかを出力してください。
制約
- 1 \leq N \leq 100
- 1 \leq P_i \leq N
- i \neq j \implies P_i \neq P_j
- 入力はすべて整数
入力
入力は以下の形式で標準入力から与えられる。
N P_1 P_2 \ldots P_N
出力
K = 1, 2, \ldots, N のそれぞれに対する答え X_K を、下記の形式にしたがって空白区切りで出力せよ。
X_1 X_2 \ldots X_N
入力例 1
5 5 2 4 1 3
出力例 1
4 2 5 3 1
- K = 1 について、1 は数列 P の 4 番目の要素です。
- K = 2 について、2 は数列 P の 2 番目の要素です。
- K = 3 について、3 は数列 P の 5 番目の要素です。
- K = 4 について、4 は数列 P の 3 番目の要素です。
- K = 5 について、5 は数列 P の 1 番目の要素です。
入力例 2
1 1
出力例 2
1
入力例 3
10 10 2 3 7 8 6 1 9 5 4
出力例 3
7 2 3 10 9 6 4 5 8 1
Problem Statement
You are given a sequence P = (P_1, P_2, \ldots, P_N) that is a permutation of a length-N sequence (1, 2, 3, \ldots, N).
For each K = 1, 2, \ldots, N, find the integer X_K such that K is the X_K-th element of the sequence P.
Constraints
- 1 \leq N \leq 100
- 1 \leq P_i \leq N
- i \neq j \implies P_i \neq P_j
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
N P_1 P_2 \ldots P_N
Output
Print the answers X_K for K = 1, 2, \ldots, N in the following format, separated by spaces.
X_1 X_2 \ldots X_N
Sample Input 1
5 5 2 4 1 3
Sample Output 1
4 2 5 3 1
- For K = 1, 1 is the 4-th element of the sequence P.
- For K = 2, 2 is the 2-nd element of the sequence P.
- For K = 3, 3 is the 5-th element of the sequence P.
- For K = 4, 4 is the 3-rd element of the sequence P.
- For K = 5, 5 is the 1-st element of the sequence P.
Sample Input 2
1 1
Sample Output 2
1
Sample Input 3
10 10 2 3 7 8 6 1 9 5 4
Sample Output 3
7 2 3 10 9 6 4 5 8 1