CF252B.Unsorting Array

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of nn 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 aa (the array elements are indexed from 1) consisting of nn elements is called sorted if it meets at least one of the following two conditions:

  1. a1<=a2<=...<=ana_{1}<=a_{2}<=...<=a_{n} ;
  2. a1>=a2>=...>=ana_{1}>=a_{2}>=...>=a_{n} .

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

输入格式

The first line contains a single integer nn ( 1<=n<=1051<=n<=10^{5} ). The second line contains nn non-negative space-separated integers a1,a2,...,ana_{1},a_{2},...,a_{n} — the elements of the array that Petya's mother presented him. All integers in the input do not exceed 10910^{9} .

输出格式

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 11 to nn .

输入输出样例

  • 输入#1

    1
    1
    

    输出#1

    -1
    
  • 输入#2

    2
    1 2
    

    输出#2

    -1
    
  • 输入#3

    4
    1 2 3 4
    

    输出#3

    1 2
    
  • 输入#4

    3
    1 1 1
    

    输出#4

    -1
    

说明/提示

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.

首页