PivotOJ

Mixtape Management

시간 제한: 1000ms메모리 제한: 512MB출처: GCPC 2020BOJ 20913

문제

Mary has created a mixtape with her favourite reggae tracks. The mixtape consists of a list of MP3 files on her computer that she wants to share with her friends Wendy and Larry. However she knows that her friends have different musical tastes and will therefore also have different preferences for the order in which the tracks are played.

Mary knows that Wendy is a Windows user and Larry is a Linux user and realised that she can use this to her advantage. This is because Windows and Linux use different methods to sort files within a directory in case their names contain numerical data. In Windows, numbers in file names are read as actual numbers, causing the files to be sorted by increasing values of these numbers. In Linux, there is no special handling for numbers, so file names are sorted lexicographically. See Figure M.1 for an example of file sorting on the two operating systems.

Linux Windows
337.mp3 7.mp3
34.mp3 34.mp3
3401.mp3 79.mp3
7.mp3 337.mp3
780.mp3 780.mp3
7803.mp3 3401.mp3
79.mp3 7803.mp3

Figure M.1: Illustration of the first sample case. Note that the file extensions .mp3 do not influence the ordering and are purely for illustration.

After deciding on the order in which she wants Wendy and Larry to listen to the tracks, Mary has already sorted the files according to Larry's taste. Now she wants to rename the files such that the filenames are distinct positive integers without leading zeroes, they are sorted in increasing lexicographic order, and when sorting them by value the new order will match Wendy's taste. For this purpose, she has come up with a permutation p1,,pnp_1,\dots,p_n that describes how to rearrange Larry's list into Wendy's list: for every ii, the iith number in lexicographic order needs to be the pip_ith smallest by value. Help Mary find a suitable sequence of filenames.

입력

The input consists of:

  • One line with an integer nn (1n1001 \le n \le 100), the number of tracks.
  • One line with nn distinct integers p1,,pnp_1,\dots,p_n (1pin1 \le p_i \le n for each ii), the given permutation.

출력

Output nn distinct integers in lexicographically increasing order, your sequence of filenames. All numbers must be positive integers less than 10100010^{1000} and may not contain leading zeroes. Any valid sequence of filenames will be accepted.

예제

예제 1

입력
7
4 2 6 1 5 7 3
출력
337 34 3401 7 780 7803 79

예제 2

입력
4
4 1 3 2
출력
234 6 87 9
이 문제는 채점 준비 중입니다. 테스트 데이터가 확보되면 제출이 가능합니다.