911A.md (957B)
1 Source: https://codeforces.com/problemset/problem/911/A 2 3 A. Nearest Minimums 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 You are given an array of *n* integer numbers *a*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. 22 23 Input 24 25 The first line contains positive integer *n* (2 ≤ *n* ≤ 105) — size of the given array. The second line contains *n* integers *a*0, *a*1, ..., *a**n* - 1 (1 ≤ *a**i* ≤ 109) — elements of the array. It is guaranteed that in the array a minimum occurs at least two times. 26 27 Output 28 29 Print the only number — distance between two nearest minimums in the array. 30 31 Examples 32 33 Input 34 35 ``` 36 2 37 3 3 38 ``` 39 40 Output 41 42 ``` 43 1 44 ``` 45 46 Input 47 48 ``` 49 3 50 5 6 5 51 ``` 52 53 Output 54 55 ``` 56 2 57 ``` 58 59 Input 60 61 ``` 62 9 63 2 1 3 5 4 1 2 3 1 64 ``` 65 66 Output 67 68 ``` 69 3 70 ```