#C6436. Prioritize Disaster Sites

    ID: 50196 Type: Default 1000ms 256MiB

Prioritize Disaster Sites

Prioritize Disaster Sites

Your task is to help the disaster management team to prioritize the disaster sites based on the severity levels. Given the number of sites N and their corresponding severity levels, you need to output the indices of the sites sorted by descending severity. In the event of a tie (i.e., two sites having the same severity), the site with the smaller index (i.e., appeared earlier) should come first.

Mathematical Formulation:

Let \( s_i \) be the severity level for site \( i \) where \( 1 \leq i \leq N \). You are required to sort the sites such that if \( i \) comes before \( j \), then either \( s_i > s_j \) or \( s_i = s_j \) and \( i < j \).

Examples:

  • For N=5 and severity levels [10, 50, 20, 50, 30], the output should be: 2 4 5 3 1.
  • For N=4 and severity levels [10, 10, 10, 10], the output should be: 1 2 3 4.

inputFormat

The input consists of two lines:

  • The first line contains one integer N (1 \(\leq N \leq 10^5\)): the number of disaster sites.
  • The second line contains N space-separated integers representing the severity levels for each site.

outputFormat

Output a single line containing N space-separated integers, representing the indices of the sites sorted by descending severity. In case of ties, the site with the lower index comes first.

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