#B4152. Grade Ranking Matrix
Grade Ranking Matrix
Grade Ranking Matrix
Teacher Gao cares a lot about the classroom environment. After each exam, he wants to know the ranking of every student sitting in the class in order to reassign the seats so that students of different levels are evenly distributed. The classroom seating is arranged in an \(N \times N\) square (i.e. \(N\) rows and \(N\) columns). Each student has an integer score between 0 and 100. Your task is to output a new \(N \times N\) matrix where each score is replaced by its ranking. Note that if two or more students have the same score, they receive the same rank. The ranking is defined such that the rank of a score is equal to \(1 + (\text{number of distinct scores greater than it})\).
Example:
Input: 2 70 80 90 80</p>Output: 3 2 1 2
inputFormat
The first line contains an integer \(N\) denoting the size of the matrix. The next \(N\) lines each contain \(N\) integers representing the scores in the matrix.
outputFormat
Output an \(N \times N\) matrix where each original score is replaced by its rank. Each row should be printed on a new line with the ranks separated by spaces.
sample
1
100
1
</p>