P28025 [洛谷] [CCC 2024 J3] Bronze Count
普及-
题目描述

Problem Description

After a competition, you might be eager to know how many participants have won a bronze medal.

Gold medals are awarded to all participants with the highest score. Silver medals are awarded to all participants with the second-highest score. Bronze medals are awarded to all participants with the third-highest score.

Given a list of scores of participants, determine the score required to win a bronze medal and how many participants exactly achieved this score.

Input Format

The first line of input contains a positive integer $N$, representing the number of participants.

The next $N$ lines each contain an integer representing the score of a participant.

Each score is guaranteed to be between $0$ and $75$ (inclusive) and there are at least three distinct scores.

Output Format

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

Sample Input and Output

Sample Input #1

4
70
62
58
73

Sample Output #1

62 1

Sample Input #2

8
75
70
60
70
70
60
75
70

Sample Output #2

60 2

Notes

[Sample 1 Explanation]

To win a bronze medal, a score of $62$ is required, and there is one participant who exactly achieved this score.

[Sample 2 Explanation]

To win a bronze medal, a score of $60$ is required, and there are two participants who exactly achieved this score.

[Data Range]

This problem uses batched testing.

For all data, it is guaranteed that $1 \leq N \leq 2.5 \times 10^5$, and the score $s$ satisfies $0 \leq s \leq 75$, with at least three distinct scores.

The following table shows the distribution of $15$ points:

Points Description Range
$6$ All scores are distinct and the number of participants is small. $N \leq 50$
$7$ Scores may be the same and the number of participants is small. $N \leq 50$
$2$ Scores may be the same and the number of participants can be large. $N \leq 2.5 \times 10^5$
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
4 70 62 58 73
样例输出
62 1