CF22A.Second Order Statistics

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. Help Bob solve this problem.

输入格式

The first input line contains integer nn ( 1<=n<=1001<=n<=100 ) — amount of numbers in the sequence. The second line contains nn space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.

输出格式

If the given sequence has the second order statistics, output this order statistics, otherwise output NO.

输入输出样例

  • 输入#1

    4
    1 2 2 -4
    

    输出#1

    1
    
  • 输入#2

    5
    1 2 3 1 1
    

    输出#2

    2
    
首页