ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Сборники > Kovrov IT 2009 > задача:


G. What about judges?

Задачи сборника

• A. Tetris 3D
• B. Knights of the Rook
• C. Meat store
• D. Many-coloured roads
• E. Kovrov
• F. Interesting permutations
• G. What about judges?
• H. Triangles
• I. ATM

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 3000/6000/6000/6000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Автор: Павел Кузнецов, ПГУ.

In order to check team's solutions in automatic mode, the problem authors have to write a checker, besided the statements and the tests. In case when there are several correct answers, the checker cannot just compare the team answer with correct answer.

Your task is to help the authors of "Interesting permutations" problem and write the checker for it. In other words, you are given a permutation of N numbers and you must find out whether it is interesting or not.

As a reminder, according to the statement of the "Interesting permutations" problem, a permutation is called interesting if it does not contain 3 numbers that make an arithmetic progression. For example, permutations 2, 1, 3 and 4, 2, 3, 1 are interesting. On the contrary, permutation 5, 1, 2, 4, 3 is not interesting, since it contains numbers 1, 2, 3 that make an arithmetic progression. It does not matter that there is a number 4 between 2 and 3. The ascending or descending order of numbers is all that matters. Also you can take 5, 4, 3, since these numbers also make the arithmetic progression.

Input
The first line contains a single integer N (3 ≤ N ≤ 100000). The next line contains N numbers of permutation. Numbers are separated by spaces.
Output
Output a single word "YES" (capital letters and no quotes), if the permutation is interesting. Otherwise, the first line should contain the word "NO" (capital letters and no quotes). The second line should contain three numbers - positions of elements, that make the arithmetic progression. Positions are numbered from 1 to N. Positions should be in ascending order. If there are several answers, you may output any of them.

Input 1 Output 1
5
3 2 4 5 1
NO
1 3 4
Input 2 Output 2
5
3 1 5 2 4
YES

Для отправки решений необходимо выполнить вход.

www.contester.ru