#P10466. 邻值查找
邻值查找
Problem Description
Given a sequence of length , all numbers in are distinct.
For each number in , find:
and the index that makes the above expression reach its minimum (denoted as ). If the minimum is not unique, choose the one with the smaller .
Input Format
The first line contains an integer , the length of the sequence.
The second line contains integers , representing the values of the sequence, separated by spaces.
Output Format
Output a total of lines, each line containing two integers separated by a space.
For each from , output the corresponding values of and .
3
1 5 3
4 1
2 1
Hint
For of the testdata, .
For of the testdata, .
For of the testdata, .
Translated by ChatGPT 5