#C12456. Score Summary
Score Summary
Score Summary
You are given a list of scores. Your task is to compute a summary containing the following five components:
- (\textbf{highest}) score
- (\textbf{lowest}) score
- (\textbf{average}) score, computed as (\frac{\sum_{i=1}^{n}{s_i}}{n})
- (\textbf{median}) score, where if (n) is even, the median is defined as (\frac{a_{\frac{n}{2}} + a_{\frac{n}{2}+1}}{2}) after sorting the scores
- A list of all unique scores in ascending order
If the list is empty (i.e. (n = 0)), output null for the numerical values and an empty array for the unique scores.
inputFormat
The input is given via standard input (stdin). The first line contains an integer (n) representing the number of scores. The second line contains (n) space‐separated integers. If (n = 0), the second line will be absent or empty.
outputFormat
Output the summary as a JSON object to standard output (stdout) with the following keys:
- "highest"
- "lowest"
- "average"
- "median"
- "unique_scores"
For an empty input (i.e. when (n = 0)), the numerical values should be null and the unique_scores should be an empty list.## sample
8
88 75 90 100 62 75 88 92
{"highest":100,"lowest":62,"average":83.75,"median":88,"unique_scores":[62,75,88,90,92,100]}