#P10292. Determining the Bronze Medal Score
Determining the Bronze Medal Score
Determining the Bronze Medal Score
After a contest, you might be eager to know how many contestants won the bronze medal. In this contest, medals are awarded based on the following rules:
- The gold medal is awarded to all contestants who achieved the highest score.
- The silver medal is awarded to all contestants with the second highest score.
- The bronze medal is awarded to all contestants with the third highest score.
Given a list of scores of all contestants, determine the bronze medal score and the number of contestants who exactly achieved that score.
The mathematical formulation: Let \(U\) be the set of distinct scores sorted in descending order. Then the bronze medal score is
\[ B = U_3 \]and the output should be \(B\) along with the count of \(B\) in the original list.
inputFormat
The first line contains an integer n representing the number of contestants. The second line contains n integers, representing the scores of the contestants.
outputFormat
Output two integers separated by a space: the bronze medal score and the count of contestants who achieved that score.
sample
5
10 30 30 20 10
10 2