GFSS Christmas Challenge P2 - Height Inspection

View as PDF

Submit solution

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

Author:
Problem type

It's Christmas season and Santa is training a new class of elves to carry out the logistics and operations of delivering presents. The class of 2021 has N students.

Before Santa starts instructing, he would like to conduct a survey on the heights of all N students. Naturally, there are different tasks at the North Pole which tall and short people are better suited for.

Since N is large, he requires your assistance to write a program to determine the height of the shortest and tallest student. Can you help Santa?

Input Specification

The first line contains N (1N105).

The next N lines each contain an integer hi (1hi103), representing the height of the i-th student.

Output Specification

Output two values on separate lines, the height of the shortest and tallest student, respectively.

Sample Input

Copy
5
3
6
7
1
2

Sample Output

Copy
1
7

Explanation

The heights of the 5 students are [3,6,7,1,2].

The first line of output represents the height of the shortest student - 1.

The second line of output represents the height of the tallest student - 7.


Comments

There are no comments at the moment.