#P10292. [CCC 2024 J3] Bronze Count

[CCC 2024 J3] Bronze Count

Problem Description

After a contest ends, you may urgently want to know how many contestants received a bronze medal.

Gold medals are awarded to all contestants who achieved the highest score. Silver medals are awarded to all contestants who achieved the second-highest score. Bronze medals are awarded to all contestants who achieved the third-highest score.

Given a list of contestants’ scores, find the score required to receive a bronze medal and how many people got exactly that score.

Input Format

The first line of input contains a positive integer NN, the number of contestants.

The next NN lines each contain one integer, the score of a contestant.

It is guaranteed that each score is between 00 and 7575 (inclusive), and that there are at least three distinct scores.

Output Format

Output a non-negative integer SS and a positive integer PP, separated by a space. Here, SS is the score required to receive a bronze medal, and PP is the number of contestants who got exactly this score.

4
70
62
58
73
62 1
8
75
70
60
70
70
60
75
70
60 2

Hint

[Sample 1 Explanation]

A bronze medal requires a score of 6262, and there is one contestant who got exactly this score.

[Sample 2 Explanation]

A bronze medal requires a score of 6060, and there are two contestants who got exactly this score.

[Constraints]

This problem uses bundled testdata.

For all testdata, it is guaranteed that 1N2.5×1051 \leq N \leq 2.5 \times 10^5, the score ss satisfies 0s750 \leq s \leq 75, and there are at least three distinct scores.

The table below shows the distribution of the 1515 points:

Score Description Range
66 All scores are distinct, and the number of contestants is small. N50N \leq 50
77 Scores may repeat, and the number of contestants is small.
22 Scores may repeat, and the number of contestants can be large. N2.5×105N \leq 2.5 \times 10^5

Translated by ChatGPT 5