#K41292. Sort Books by Popularity

    ID: 26833 Type: Default 1000ms 256MiB

Sort Books by Popularity

Sort Books by Popularity

You are given n books with their corresponding popularity scores. The books are numbered from 1 to n in the order of their appearance.

Your task is to sort the books in descending order according to their popularity scores. In case of a tie where two books have the same popularity score, maintain their original order (i.e. the one that appears sooner in the input should come first).

Formally, let the score of the book i be denoted as \(s_i\). You need to output a permutation \(p_1, p_2, \dots, p_n\) of \(\{1, 2, \dots, n\}\) such that for any two positions \(i\) and \(j\) with \(i

inputFormat

The input is read from standard input (stdin) and consists of two lines:

  1. The first line contains a single integer \(n\) indicating the number of books.
  2. The second line contains \(n\) space-separated integers representing the popularity scores of the books.

outputFormat

Output to standard output (stdout) a single line containing \(n\) space-separated integers representing the book numbers in sorted order by descending popularity (maintaining initial order for equal scores).

## sample
4
10 50 30 20
2 3 4 1