侦察 2AI (CI翻译)
$*n*$ soldiers stand in a circle. For each soldier, his height $*a*_{*i*}$ is known. A reconnaissance unit can be made of such two neighbouring soldiers, whose height difference is minimal, i.e. $|*a*_{*i*} - *a*_{*j*}|$ is minimal. So each of them will be less noticeable with the other. Output any pair of soldiers that can form a reconnaissance unit.
$*n*$ 名士兵站成一圈。已知每名士兵的身高 $*a*_{*i*}$。侦察小组可以由两名相邻的士兵组成,并且这两名士兵的身高差应当最小,即 $|*a*_{*i*} - *a*_{*j*}|$ 最小。请输出任意一对能够组成侦察小组的士兵。AI (CI翻译)
Input
输入格式
AI (CI翻译)The first line contains an integer $*n*$ ($2 ≤ *n* ≤ 100$) — the number of soldiers. Then follow the heights of the soldiers in their order in the circle — $*n*$ space-separated integers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$ ($1 ≤ *a*_{*i*} ≤ 1000$). The soldier heights are given in a clockwise or counterclockwise direction.
第一行包含一个整数 $*n*$($2 ≤ *n* ≤ 100$),表示士兵的数量。接下来一行按士兵在圆圈中的顺序给出他们的身高,共有 $*n*$ 个用空格分隔的整数 $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$($1 ≤ *a*_{*i*} ≤ 1000$)。士兵的身高按照顺时针或逆时针方向给出。AI (CI翻译)
Output
输出格式
AI (CI翻译)Output two integers — indices of neighbouring soldiers, who should form a reconnaissance unit. If there are many optimal solutions, output any of them. Remember that the soldiers stand in a circle.
输出两个整数,表示应组成侦察小组的两名相邻士兵的下标。如果有多组最优解,输出任意一组。请注意,士兵站成一个圆圈。AI (CI翻译)
样例
5
10 12 13 15 10
5 1
4
10 20 30 40
1 2
题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。