#K56257. Competition Results Analysis

    ID: 30158 Type: Default 1000ms 256MiB

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:

  1. An integer \(T\) indicating the number of test cases.
  2. For each test case:
    1. An integer \(N\) representing the number of students.
    2. \(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.
## sample
1
5
Alice 78
Bob 92
Charlie 89
David 92
Eve 78
Bob,David Alice,Eve 89 2 2

</p>