102003: [AtCoder]ABC200 D - Happy Birthday! 2

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

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.

Input

题意翻译

给你一个含有 $N$ 个正整数的序列 $A$,请你构造两个序列 $B$ 和 $C$。 设这两个序列长度分别为 $x$ 和 $y$,则应满足: - $1 \leq x, y \leq N$ - $1 \leq B_i, C_i \leq N$ 且两序列均严格递增 - $B$ 与 $C$ 互异 - $\displaystyle \sum_{i=1}^{x} A_{B_i} \equiv \sum_{j=1}^{y} A_{c_i} (\bmod\space200)$ 其中互异的定义:若 $x\not= y$ 或 $x=y$ 但存在一个位置 $i$ 使得 $B_i \not= C_i$,则 $B$ 与 $C$ 互异。

加入题单

上一题 下一题 算法标签: