Longest Increasing Subsequence

아직 제출이 없습니다시간 제한1초메모리 제한256 MB

문제

Given f_1,f_2,,f_nf\_1, f\_2, \ldots, f\_n, find a permutation p_1,p_2,,p_np\_1, p\_2, \ldots, p\_n of integers 1,2,,n1, 2, \ldots, n such that, for each ii, the length of the longest strictly increasing subsequence ending with p_ip\_i is f_if\_i.

입력

The first line contains an integer nn (1n1051 \leq n \leq 10^5).

The second line contains nn integers f_1,f_2,,f_nf\_1, f\_2, \ldots, f\_n (1f_in1 \leq f\_i \leq n). It is guaranteed that, for the given input, at least one such permutation p_1,p_2,,p_np\_1, p\_2, \ldots, p\_n exists.

출력

On the first line, print nn integers p_1,p_2,,p_np\_1, p\_2, \ldots, p\_n. These numbers must form a permutation of integers 1,2,,n1, 2, \ldots, n. If there are several possible answers, print any one of them.