## DMOPC '19 Contest 2 P1 - Box and Whiskers

View as PDF

Points: 5
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Veshy is struggling in data management class. Veshy forgot how to make a box and whisker plot, so he wants you to tell him the important values to make the plot of the data points . He gives you: the minimum, maximum, (Quartile 1 or median of the first elements), (Quartile 2 or median of the entire data), and (Quartile 3 or median of the last elements) of the sorted list.
For example, if the data set was , the important values in their respective order would be: 1, 10, 3, 5.5, 8
Another example, if the data set was , the important values in their respective order would be: 1, 11, 3, 6, 9

#### Constraints

In all tests,

All numbers are guaranteed to be whole numbers.

#### Input Specification

The first line contains a number, , the number of data points.
The second line contains numbers separated by spaces, the data points Veshy gives you:
Note: the data points are not guaranteed to be in sorted order.

#### Output Specification

Output the minimum, maximum, , , , in that order separated by spaces on a single line.
Note: your answer will be judged as correct if it is within an absolute or relative error of .

#### Sample Input 1

10
1 2 3 4 5 6 7 8 9 10

#### Sample Output 1

1 10 3 5.5 8

#### Sample Input 2

11
1 2 3 4 5 6 7 8 9 10 11

#### Sample Output 2

1 11 3 6 9

• commented on Feb. 25, 2022, 7:37 p.m.

I get the first 4 right, but the 5th one is WA. Can someone take a look at my code please?

• commented on Feb. 25, 2022, 9:13 p.m.

Try this test case:

5
999995 999996 999997 999998 999999