Logo
(追記) (追記ここまで)

19483번 - Vier 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB43191446.667%

문제

The online game you've built in problem "Oha" involves $n$ types of monsters. The monster types are numbered from 1 to $n,ドル and a monster of $i$-th type has strength $i$ and magical ability $\pi_i$. All magical abilities are different integers between 1ドル$ and $n,ドル inclusive, in other words, $\pi$ is a permutation. For simplicity, you have generated this permutation uniformly at random.

Now you need to choose the starting teams of monsters for the two sides of the game. Each side must have exactly two monsters in the starting team (they can be of the same type), and the starting teams must be different. However, in order for the game to be balanced, the starting teams must have the same total strength modulo $n$ and the same total magical ability modulo $n$.

More formally, you need to find four integers $a,ドル $b,ドル $c$ and $d$ between 1 and $n$ such that:

  1. $a+b \equiv c+d \pmod{n},ドル and
  2. $\pi_a + \pi_b \equiv \pi_c + \pi_d \pmod{n}$.

Note that the above statements are trivially true when $a=c$ and $b=d,ドル or when $a=d$ and $b=c$. You need to find any other solution, or report that there isn't any. Note that it's allowed for some of the four integers to coincide --- the only restriction is that they can't coincide in the two ways described in the first sentence of this paragraph.

입력

The first line of the input file contains one integer $n,ドル 2ドル \le n \le 10^6$. The second line of the input file contains $n$ distinct integers, each between 1 and $n$. The $i$-th of those integers gives the value of $\pi_i$.

It is guaranteed that the permutation was picked uniformly at random out of all permutations of $n$ integers.

출력

If a non-trivial solution exists, print Ja on the first line of the output file, otherwise print Nein. In case you printed Ja, on the second line print four integers between 1 and $n$: $a,ドル $b,ドル $c$ and $d$.

제한

예제 입력 1

5
2 4 3 5 1

예제 출력 1

Ja
5 5 1 4

힌트

There are 50 non-sample testcases in this problem.

출처

Camp > Petrozavodsk Programming Camp > Summer 2016 > Day 5: Petr Mitrichev Contest 14 I번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /