|시간 제한||메모리 제한||제출||정답||맞힌 사람||정답 비율|
|1 초||64 MB||30||26||23||88.462%|
As you know, escape rooms became very popular since they allow you to play the role of a video game hero. One such room has the following quiz. You know that the locker password is a permutation of N numbers. A permutation of length N is a sequence of distinct positive integers, whose values are at most N. You got the following hint regarding the password - the length of the longest increasing subsequence starting at position i equals Ai. Therefore you want to find the password using these values. As there can be several possible permutations you want to find the lexicographically smallest one. Permutation P is lexicographically smaller than permutation Q if there is an index i such that Pi < Qi and Pj = Qj for all j < i. It is guaranteed that there is at least one possible permutation satisfying the above constraints. Can you open the door?
The first line of the input contains one integer N (1 ≤ N ≤ 105).
The next line contains N space-separated integer Ai (1 ≤ Ai ≤ N).
It’s guaranteed that at least one possible permutation exists.
Print in one line the lexicographically smallest permutation that satisfies all the conditions.
4 1 2 2 1
4 2 1 3