The distinct scores in descending order are 100, 50, and 20, so the ranks are 1 2 1 3 2.
Output
1 2 1 3 2
Input
4
-1 -5 0 -1
Explanation
The distinct scores are 0, -1, and -5, giving ranks 2 3 1 2 in input order.
Output
2 3 1 2
Input
3
7 7 7
Explanation
There is only one distinct score, so every position receives rank 1.
Output
1 1 1
Given a list of scores, replace each score by its rank among distinct scores in descending order. The highest distinct score has rank 1. Equal scores receive the same rank.