#K56257. Competition Results Analysis
Competition Results Analysis
Competition Results Analysis
This problem requires you to analyze the results of multiple competitions. In each competition, you are given a list of students with their scores. Your task is to determine the following for each test case:
- The highest scorer(s) (names concatenated by commas in their original order of appearance).
- The lowest scorer(s) (names concatenated by commas in their original order of appearance).
- The median score calculated from the sorted list of scores. For an odd number of scores, the median is the middle value; for an even number, the median is given by \(\text{median}=\text{round}(\frac{s_{\frac{n}{2}-1}+s_{\frac{n}{2}}}{2})\).
- The count of students scoring above the median.
- The count of students scoring below the median.
The output for each test case should display these five values in order, separated by a single space.
inputFormat
The input is read from stdin and has the following format:
- An integer \(T\) indicating the number of test cases.
- For each test case:
- An integer \(N\) representing the number of students.
- \(N\) lines follow, each containing a student's name (a string without spaces) and an integer score, separated by a space.
outputFormat
For each test case, output a single line to stdout containing five items separated by a space:
- Highest scorer(s) as a comma-separated string.
- Lowest scorer(s) as a comma-separated string.
- The median score (an integer).
- Number of students with scores above the median.
- Number of students with scores below the median.
1
5
Alice 78
Bob 92
Charlie 89
David 92
Eve 78
Bob,David Alice,Eve 89 2 2
</p>