QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 1024 MB

#23925. Marathon Race

Statistics

Problem Statement

At JOI High School, there are $N$ students, numbered from $1$ to $N$.

Last month, a marathon race was held at JOI High School, and all the students participated in it. The record of student $i$ ($1 \le i \le N$) was $A_i$ minutes.

Find the rank of each student in the marathon race. Here, the rank of student $i$ ($1 \le i \le N$) is calculated as (the number of students whose record is less than $A_i$ minutes) $+ 1$.

Constraints

  • $1 \le N \le 100$.
  • $1 \le A_i \le 1000$ ($1 \le i \le N$).
  • All input values are integers.

Input

The input is given in the following format:

$N$ $A_1 \ A_2 \ \dots \ A_N$

Output

Output $N$ lines. On the $i$-th line ($1 \le i \le N$), output the rank of student $i$.

Sample Input and Output

Sample Input 1

3
44 42 69

Sample Output 1

2
1
3
  • The record of student $1$ is $44$ minutes. Since there is $1$ student whose record is less than $44$ minutes, the rank of student $1$ is $2$-nd place. Therefore, output $2$ on the $1$-st line.
  • The record of student $2$ is $42$ minutes. Since there are no students whose record is less than $42$ minutes, the rank of student $2$ is $1$-st place. Therefore, output $1$ on the $2$-nd line.
  • The record of student $3$ is $69$ minutes. Since there are $2$ students whose record is less than $69$ minutes, the rank of student $3$ is $3$-rd place. Therefore, output $3$ on the $3$-rd line.

Sample Input 2

4
40 60 40 60

Sample Output 2

1
3
1
3
  • The record of student $1$ is $40$ minutes. Since there are no students whose record is less than $40$ minutes, the rank of student $1$ is $1$-st place. Therefore, output $1$ on the $1$-st line.
  • The record of student $2$ is $60$ minutes. Since there are $2$ students whose record is less than $60$ minutes, the rank of student $2$ is $3$-rd place. Therefore, output $3$ on the $2$-nd line.
  • The record of student $3$ is $40$ minutes. Since there are no students whose record is less than $40$ minutes, the rank of student $3$ is $1$-st place. Therefore, output $1$ on the $3$-rd line.
  • The record of student $4$ is $60$ minutes. Since there are $2$ students whose record is less than $60$ minutes, the rank of student $4$ is $3$-rd place. Therefore, output $3$ on the $4$-th line.

Sample Input 3

10
766 152 595 926 663 509 368 595 175 622

Sample Output 3

9
1
5
10
8
4
3
5
2
7

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.