Racing - MarisaOJ: Marisa Online Judge

Racing

Time limit: 1000 ms
Memory limit: 256 MB
The annual racing contest in Gensokyo had kicked off, with a range of participants numbering from $1$ to $n$. Among them were various Youkai types and even some humans. To ensure fairness, the contestants didn't start all at once but rather in sequence according to their assigned numbers. That meant the first contestant, number $1$, had the honor of starting first, followed by the second contestant, number $2$, and so on. The speed of each contestant does not change through out the entire race. After the first round concluded, journalist Aya Shimeimaru approached Reimu Hakurei, one of the contestants, for an interview. The conversation between Aya and Reimu unfolded as follows: _Aya: "Could you share with us the race rankings?"_ \ _Reimu: "That'll cost you a million yen, please!"_ Unable to afford such a hefty sum, Aya sought another interviewee and turned to Marisa Kirisame. _Aya: "Can you give us insights into the race rankings?"_ \ _Marisa: "Directly telling you won't be fun, da ze☆. But I can reveal how many contestants managed to surpass each participant before reaching the finish line. Just remember, no two participants finished the race simultaneously!☆☆~~_ Marisa then handed Aya an array $A$ with $n$ elements, where $A_i$ represented the number of contestants who surpassed contestant $i$. Feeling confused, Aya asked for help in reconstructing the race rankings. ### Input - The first line contains an integer $n$. - The second line contains $n$ integer $A_i$. - Marisa guaranteed that the answer exists! ze!⭐⭐ ### Output - Print a permutation of integers from $1$ to $n$, the $i^{th}$ represents the ordinal number of the participant who finishes in the $i^{th}$ position. ### Constraints - $1 \le n \le 10^6$. - $0 \le A_i \le n - 1$. ### Example Input: ``` 9 2 3 6 4 0 2 2 1 0 ``` Output: ``` 5 9 1 8 2 6 4 7 3 ```