P10292 [CCC 2024 J3] Bronze Count

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. ![](https://cdn.luogu.com.cn/upload/image_hosting/l5gzr1cf.png)

Input Format

The first line of input contains a positive integer $N$, the number of contestants. The next $N$ lines each contain one integer, the score of a contestant. It is guaranteed that each score is between $0$ and $75$ (inclusive), and that there are at least three distinct scores.

Output Format

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

Explanation/Hint

**[Sample 1 Explanation]** A bronze medal requires a score of $62$, and there is one contestant who got exactly this score. **[Sample 2 Explanation]** A bronze medal requires a score of $60$, and there are two contestants who got exactly this score. **[Constraints]** **This problem uses bundled testdata.** For all testdata, it is guaranteed that $1 \leq N \leq 2.5 \times 10^5$, the score $s$ satisfies $0 \leq s \leq 75$, and there are at least three distinct scores. The table below shows the distribution of the $15$ points: | Score | Description | Range | | :-: | :- | :-: | | $6$ | All scores are distinct, and the number of contestants is small. | $N \leq 50$ | | $7$ | Scores may repeat, and the number of contestants is small. | $N \leq 50$ | | $2$ | Scores may repeat, and the number of contestants can be large. | $N \leq 2.5 \times 10^5$ | Translated by ChatGPT 5