#K59837. Find the Minimum and Maximum in an Array

    ID: 30953 Type: Default 1000ms 256MiB

Find the Minimum and Maximum in an Array

Find the Minimum and Maximum in an Array

Given an array of integers, your task is to determine the minimum and maximum values in the array. Formally, you are provided with an integer (N) and an array (a_1, a_2, \dots, a_N). You need to compute (\min(a_i)) and (\max(a_i)). If the array is empty (i.e., when (N = 0)), output "None None".

For example, if the array is [1, 3, 5, 7, 9], then the output should be 1 9.

inputFormat

The input consists of two lines. The first line contains an integer (N) representing the number of elements. The second line contains (N) space-separated integers which form the array.

outputFormat

Output two space-separated values: the minimum and maximum element of the array. If (N = 0), output "None None".## sample

5
1 3 5 7 9
1 9