#C3216. Ranking of Participants
Ranking of Participants
Ranking of Participants
You are given the scores of n participants in a competition. Your task is to calculate each participant's rank based on their score. The participant with the highest score is assigned a rank of 1, the next unique score is assigned the next rank, and so on. If two or more participants have the same score, they receive the same rank.
The ranking can be defined using the formula:
$$r_i = \left|\{j\, :\, s_j > s_i\}\right| + 1$$
where \(s_i\) is the score of the i-th participant and \(r_i\) is their rank.
inputFormat
The input is read from standard input (stdin) and is formatted as follows:
- The first line contains a single integer n representing the number of participants.
- The second line contains n space-separated integers, where each integer represents the score of a participant.
outputFormat
Output to standard output (stdout) a single line containing n integers. These integers represent the ranks of the participants in the order of the input scores, separated by a space.
## sample5
100 200 100 300 200
4 2 4 1 2