| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 9 | 9 | 9 | 100.000% |
There are $n$ runners participating in a race. Each runner is assigned a unique number from 1ドル$ to $n$. They have arrived at the finish line in some specific order, with no ties. Let us say that runner $i$ has performed an upset of runner $j$ if $i$ finished before $j$ and $i < j$.
For each $i$ from 1ドル$ to $n,ドル it is known that runner $i$ has performed exactly $a_i$ upsets of other runners. Your task is to restore the competition results: the number of the runner that took first place, the number of the runner that took second place, \ldots, the number of the runner that took the $n$-th place. It can be shown that the answer is always unique, assuming that it exists.
The first line of the input contains an integer $n$ from 1ドル$ to 1000ドル$: the number of runners.
The second line contains $n$ space-delimited integers $a_1, a_2, \ldots, a_n,ドル where $a_i$ is the number of upsets performed by runner $i$.
The given data is consistent with some possible results of the competition: for every $i,ドル it is true that $a_i \le n - i$. In particular, $a_n = 0$.
Print $n$ space-separated integers: the numbers of runners who took first, second, \ldots, $n$-th place.
5 3 0 2 1 0
3 1 4 5 2
1 0
1
2 0 0
2 1
Let us check that the answer to the first example is consistent with the given numbers $a_i$.