#K75497. Relay Race Order

    ID: 34432 Type: Default 1000ms 256MiB

Relay Race Order

Relay Race Order

Tamara is organizing a relay race with \(n\) runners. The runners are numbered from 1 to \(n\) and each runner has an associated age. The race order must satisfy the following condition: for any two consecutive runners in the order with ages \(a_i\) and \(a_j\), it must hold that \(a_i \leq a_j\). In other words, a runner can only receive the baton from someone who is not older than themselves.

Your task is to determine a valid order in which the baton can be passed. If there are multiple valid orders, you may output any one of them. Note that each runner is unique and is identified by their index (starting from 1).

Formally, given an integer \(n\) and a list of ages \(a_1, a_2, \dots, a_n\), you need to produce a permutation \(p_1, p_2, \dots, p_n\) of \(\{1, 2, \dots, n\}\) such that if \(a_{p_i}\) and \(a_{p_j}\) are the ages of the \(i\)th and \(j\)th runners in the order (with \(i .

inputFormat

The input is given from stdin and consists of two lines:

  1. The first line contains a single integer \(n\) representing the number of runners.
  2. The second line contains \(n\) space-separated integers representing the ages of the runners.

outputFormat

Output a single line to stdout containing \(n\) space-separated integers. These integers represent a valid order of runner indices such that for each pair of consecutive runners in the order, the age of the first is less than or equal to the age of the second.

## sample
5
3 1 4 1 5
2 4 1 3 5