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

19724번 - Weight Overflow 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB49121025.641%

문제

John has recently bought an electronic balance scale from a well-known website. The scale has two plates that you can put items to. After you put some items to the scale it shows which of the plates outweighs another one, or tells that the weights on the plates are equal, and the scale is balanced.

John has started experimenting with the scale and found out that weighing results are quite strange sometimes. It turns out that the scale calculates the total weight of the items at each plate in grams and then compares the resulting values. However, since the software was written by former sport programmers, the scale calculates the weight of the items at the plate modulo some integer $m$.

John has $n$ special weights, the $i$-th weight has the mass of $a_i$ grams. He wants the scale to tell him that it is balanced by putting some of these weights to the scale plates.

Help John decide which weights he needs to put to the scale plates. He should put at least one weight to the scale.

입력

The first line of input contains two integers $n$ and $m$ --- the number of weights John has, and the modulo for weight calculation (1ドル \le n \le 25$; 1ドル \le m < 4 \cdot 10^7$).

The next line contains $n$ integers $a_1, \ldots, a_n$ --- masses of the weights John has (1ドル \le a_i \le 10^9$).

출력

If there exists an answer, print $k$ --- the number of weights that John should put to the first plate, at the first line. The second line must contain the numbers of these weights.

Then print $m$ --- the number of weights that John should put to the second plate. Print the numbers of these weights at the next line.

Weights are numbered from 1ドル$ to $n$ in the order they are given in input.

If there is no answer, print a single number "$-1$".

제한

예제 입력 1

4 14
1 3 7 10

예제 출력 1

1
4
2
2 3

예제 입력 2

3 7
1 2 4

예제 출력 2

3
1 2 3
0

힌트

출처

Olympiad > Russian Olympiad in Informatics > Russia High School Programming Contest > Russia High School Programming Contest 2019 G번

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

출처

대학교 대회

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

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