9484: ABC217 —— C - Inverse of Permutation
[Creator : ]
Description
We will call a sequence of length $N$ where each of $1,2,\dots,N$ occurs once as a permutation of length $N$.
Given a permutation of length $N$, $P = (p_1, p_2,\dots,p_N)$, print a permutation of length $N$, $Q = (q_1,\dots,q_N)$, that satisfies the following condition.
- For every $i$ $(1 \leq i \leq N)$, the $p_i$-th element of $Q$ is $i$.
It can be proved that there exists a unique $Q$ that satisfies the condition.
Given a permutation of length $N$, $P = (p_1, p_2,\dots,p_N)$, print a permutation of length $N$, $Q = (q_1,\dots,q_N)$, that satisfies the following condition.
- For every $i$ $(1 \leq i \leq N)$, the $p_i$-th element of $Q$ is $i$.
It can be proved that there exists a unique $Q$ that satisfies the condition.
Input
Input is given from Standard Input in the following format:
```
$N$
$p_1$ $p_2$ $\dots$ $p_N$
```
```
$N$
$p_1$ $p_2$ $\dots$ $p_N$
```
Output
Print the sequence $Q$ in one line, with spaces in between.
```
$q_1$ $q_2$ $\dots$ $q_N$
```
```
$q_1$ $q_2$ $\dots$ $q_N$
```
Constraints
- $1 \leq N \leq 2 \times 10^5$
- $(p_1,p_2,\dots,p_N)$ is a permutation of length $N$ (defined in Problem Statement).
- All values in input are integers.
- $(p_1,p_2,\dots,p_N)$ is a permutation of length $N$ (defined in Problem Statement).
- All values in input are integers.
Sample 1 Input
3
2 3 1
Sample 1 Output
3 1 2
The permutation Q=(3,1,2) satisfies the condition, as follows.
- For i=1, we have $p_i=2,q_2=1$.
- For i=2, we have $p_i=3,q_3=2$.
- For i=3, we have $p_i=1,q_1=3$.
Sample 2 Input
3
1 2 3
Sample 2 Output
1 2 3
If $p_i=i$ for every $i\ (1≤i≤N)$, we will have P=Q.
Sample 3 Input
5
5 3 2 4 1
Sample 3 Output
5 3 2 4 1