#C7549. Medal Distribution
Medal Distribution
Medal Distribution
You are given a competition task where you need to distribute medals to students based on their ranking. For each test case, you are provided an integer N and a list of N integers representing the ranking of each student. The medal assignment is based on the ranking: if a student's ranking is 1, assign a Gold medal; if it is 2, assign a Silver medal; if it is 3, assign a Bronze medal; and for any other ranking, assign no medal (an empty string). The task is to output the medals for each test case in the order the rankings are given.
In mathematical notation, the medal for a given rank \( r \) is defined as follows:
[ M(r) = \begin{cases} \text{Gold} & \text{if } r = 1,\ \text{Silver} & \text{if } r = 2,\ \text{Bronze} & \text{if } r = 3,\ "" & \text{otherwise.} \end{cases} ]
Your solution must read from standard input and print the result to standard output.
inputFormat
The input is read from standard input. The first line contains one integer T denoting the number of test cases. Each test case consists of two lines:
- The first line contains an integer N, the number of students.
- The second line contains N space-separated integers representing the rankings of the students.
outputFormat
For each test case, output a single line with N tokens separated by a single space. Each token is the medal assigned to the corresponding student in the input order. Output Gold
for rank 1, Silver
for rank 2, Bronze
for rank 3, and an empty string for all other rankings.
3
5
1 2 3 4 5
3
2 3 1
2
1 2
Gold Silver Bronze
Silver Bronze Gold
Gold Silver
</p>