実行時間制限: 2 sec / メモリ制限: 1024 MB
配点 : 400 点
問題文
N 個の正整数からなる数列 A = (A_1, A_2, \dots, A_N) が与えられます。 以下の条件を全て満たす 2 つの数列 B = (B_1, B_2, \dots, B_x),\ C = (C_1, C_2, \dots, C_y) が存在するか判定し、存在する場合はひとつ出力してください。
- 1 ≤ x, y ≤ N
- 1 \le B_1 < B_2 < \dots < B_{x} \le N
- 1 \le C_1 < C_2 < \dots < C_{y} \le N
- B と C は、異なる数列である。
- x ≠ y のとき、または、ある整数 i\ (1 ≤ i ≤ \min(x, y)) が存在して B_i ≠ C_i であるとき、B と C は異なるものとする。
- A_{B_1} + A_{B_2} + \dots + A_{B_x} を 200 で割った余りと A_{C_1} + A_{C_2} + \dots + A_{C_y} を 200 で割った余りが等しい。
制約
- 入力はすべて整数
- 2 \le N \le 200
- 1 \le A_i \le 10^9
入力
入力は以下の形式で標準入力から与えられる。
N A_1 A_2 \dots A_N
出力
条件を満たす数列の組 B,C が存在しない場合、1 行に No
と出力せよ。
存在する場合、以下の形式で B,C を出力せよ。
Yes x B_1 B_2 \dots B_x y C_1 C_2 \dots C_y
なお、正誤判定器は英大文字と英小文字を区別せず、どちらも受理する。
入力例 1
5 180 186 189 191 218
出力例 1
Yes 1 1 2 3 4
B=(1),C=(3,4) とすると、A_1 = 180,\ A_3 + A_4 = 380 となり、この 2 つを 200 で割った余りは等しくなります。
他にも、以下のような出力も正答として扱われます。
yEs 4 2 3 4 5 3 1 2 5
入力例 2
2 123 523
出力例 2
Yes 1 1 1 2
入力例 3
6 2013 1012 2765 2021 508 6971
出力例 3
No
条件を満たす数列の組が存在しない場合、1 行に No
と出力してください。
Score : 400 points
Problem Statement
You are given a sequence of N positive integers: A = (A_1, A_2, \dots, A_N). Determine whether there is a pair of sequences B = (B_1, B_2, \dots, B_x), C = (C_1, C_2, \dots, C_y) satisfying all of the conditions, and print one such pair if it exists.
- 1 ≤ x, y ≤ N.
- 1 \le B_1 < B_2 < \dots < B_{x} \le N.
- 1 \le C_1 < C_2 < \dots < C_{y} \le N.
- B and C are different sequences.
- Here, we consider B and C different when x ≠ y or there is an integer i\ (1 ≤ i ≤ \min(x, y)) such that B_i ≠ C_i.
- A_{B_1} + A_{B_2} + \dots + A_{B_x} and A_{C_1} + A_{C_2} + \dots + A_{C_y} are equal modulo 200.
Constraints
- All values in input are integers.
- 2 \le N \le 200
- 1 \le A_i \le 10^9
Input
Input is given from Standard Input in the following format:
N A_1 A_2 \dots A_N
Output
If there is no pair of sequences B, C satisfying the conditions, print a single line containing No
.
Otherwise, print your choice of B and C in the following format:
Yes x B_1 B_2 \dots B_x y C_1 C_2 \dots C_y
The checker is case-insensitive: you can use either uppercase or lowercase letters.
Sample Input 1
5 180 186 189 191 218
Sample Output 1
Yes 1 1 2 3 4
For B=(1),C=(3,4), we have A_1 = 180,\ A_3 + A_4 = 380, which are equal modulo 200.
There are other solutions that will also be accepted, such as:
yEs 4 2 3 4 5 3 1 2 5
Sample Input 2
2 123 523
Sample Output 2
Yes 1 1 1 2
Sample Input 3
6 2013 1012 2765 2021 508 6971
Sample Output 3
No
If there is no pair of sequences satisfying the conditions, print a single line containing No
.