#K34952. Grade Ranking

    ID: 25423 Type: Default 1000ms 256MiB

Grade Ranking

Grade Ranking

You are given a list of student grades and you need to compute the rank for each grade. The ranking is defined such that the highest grade gets rank \(1\), the second highest grade gets rank \(2\), and so on. If two or more grades are the same, they should receive the same rank.

For example, given the grade list [80, 90, 70, 80, 100], the ranks are computed as follows: the highest grade 100 gets rank \(1\), the next highest grade 90 gets rank \(2\), both occurrences of 80 get rank \(3\), and 70 gets rank \(5\). Therefore, the output is [3, 2, 5, 3, 1].

Your task is to implement this ranking computation. The input and output are handled via standard input (stdin) and standard output (stdout), respectively.

inputFormat

The input is provided on stdin in the following format:

  • The first line contains an integer \(n\) (\(n \geq 0\)), representing the number of grades.
  • If \(n > 0\), the second line contains \(n\) space-separated integers representing the grades.

outputFormat

Output a single line on stdout containing \(n\) space-separated integers. Each integer is the rank corresponding to the grade in the input order. If \(n = 0\), output an empty line.

## sample
5
80 90 70 80 100
3 2 5 3 1