아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Mixtape Management

시간 제한1초메모리 제한512 MB

요약
순열 p가 주어질 때, 사전순 순서는 인덱스 순서와 같고 수치 순서는 p를 따르는 n개의 서로 다른 양의 정수를 만든다.
난이도

보통10점 중 6점

유형
그리디, 수학, 구현, 완전 탐색
정답자
아직 제출이 없습니다

문제

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.

LinuxWindows
337.mp37.mp3
34.mp334.mp3
3401.mp379.mp3
7.mp3337.mp3
780.mp3780.mp3
7803.mp33401.mp3
79.mp37803.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 p_1,…,p_np\_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 p_ip\_ith smallest by value. Help Mary find a suitable sequence of filenames.

입력

The input consists of:

  • One line with an integer nn (1≤n≤1001 \le n \le 100), the number of tracks.
  • One line with nn distinct integers p_1,…,p_np\_1,\dots,p\_n (1≤p_i≤n1 \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.

예제2

  1. 예제 1

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

    입력
    4
    4 1 3 2
    
    예상 출력
    234 6 87 9