Codeforces Round 153 (Div. 2)
B
Unsorting Array
Codeforces
1800
原题
← A→
翻译中…

Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of $*n*$ elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. Please note that Petya can not swap equal integers even if they are in distinct positions in the array. Also note that Petya must swap some two integers even if the original array meets all requirements.

翻译中…

Array $*a*$ (the array elements are indexed from 1) consisting of $*n*$ elements is called sorted if it meets at least one of the following two conditions:

翻译中…
  1. $*a*_{1} ≤ *a*_{2} ≤ ... ≤ *a*_{*n*}$;
  2. $*a*_{1} ≥ *a*_{2} ≥ ... ≥ *a*_{*n*}$.
翻译中…

Help Petya find the two required positions to swap or else say that they do not exist.

翻译中…

Input

翻译中…

The first line contains a single integer $*n*$ ($1 ≤ *n* ≤ 10^{5}$). The second line contains $*n*$ non-negative space-separated integers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$ — the elements of the array that Petya's mother presented him. All integers in the input do not exceed $10^{9}$.

翻译中…

Output

翻译中…

If there is a pair of positions that make the array unsorted if swapped, then print the numbers of these positions separated by a space. If there are several pairs of positions, print any of them. If such pair does not exist, print -1. The positions in the array are numbered with integers from $1$ to $*n*$.

翻译中…

Note

翻译中…

In the first two samples the required pairs obviously don't exist.

翻译中…

In the third sample you can swap the first two elements. After that the array will look like this: 2 1 3 4. This array is unsorted.

翻译中…

样例

Input #1
1
1
Output #1
-1
InputCopy OutputCopy
Input #2
2
1 2
Output #2
-1
InputCopy OutputCopy
Input #3
4
1 2 3 4
Output #3
1 2
InputCopy OutputCopy
Input #4
3
1 1 1
Output #4
-1
InputCopy OutputCopy
题目信息
题号
252B
时间限制
2 s
内存限制
256 MB
标签
暴力
排序

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。