#P354. 【例61.2】 最近的一对
【例61.2】 最近的一对
Description
Given an array containing elements, find the pair of indices and in that are closest to each other, satisfying and . If multiple pairs exist, output the value of corresponding to the smallest . For example, in the array of numbers , the numbers that satisfy include . Among these, the pairs and are closer in distance, and in the case of equal distances, has a smaller index. If no identical numbers exist, output "No".
Input Format
The first line contains a single integer representing the length of the array ().
The next lines each contain a single integer, representing the elements of the array ().
Output Format
Output the value of corresponding to the smallest that meets the conditions.
Sample
10
19
13
11
19
11
5
6
3
4
311
Related
In following homework: