CF911A.Nearest Minimums

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

You are given an array of nn integer numbers a0,a1,...,an1a_{0},a_{1},...,a_{n-1} . Find the distance between two closest (nearest) minimums in it. It is guaranteed that in the array a minimum occurs at least two times.
找到一个长度为n的序列中,距离最短的最小值的距离。

输入格式

The first line contains positive integer nn ( 2<=n<=1052<=n<=10^{5} ) — size of the given array. The second line contains nn integers a0,a1,...,an1a_{0},a_{1},...,a_{n-1} ( 1<=ai<=1091<=a_{i}<=10^{9} ) — elements of the array. It is guaranteed that in the array a minimum occurs at least two times.

输出格式

Print the only number — distance between two nearest minimums in the array.

输入输出样例

  • 输入#1

    2
    3 3
    

    输出#1

    1
    
  • 输入#2

    3
    5 6 5
    

    输出#2

    2
    
  • 输入#3

    9
    2 1 3 5 4 1 2 3 1
    

    输出#3

    3
    
首页