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

View as PDF

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

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

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 Dec. 8, 2019, 4:43 p.m.

can someone give me a hint on where my code is wrong