#abc200d. D - Happy Birthday! 2(WAITING SPJ)

D - Happy Birthday! 2(WAITING SPJ)

Score : 400400 points

问题描述

给定一个包含 NN 个正整数的序列:A=(A1,A2,,AN)A = (A_1, A_2, \dots, A_N)。确定是否存在满足所有条件的一对序列 $B = (B_1, B_2, \dots, B_x), C = (C_1, C_2, \dots, C_y)$,如果存在,则打印出这样一对序列。

  • 1x,yN1 ≤ x, y ≤ N
  • 1B1<B2<<BxN1 \le B_1 < B_2 < \dots < B_{x} \le N
  • 1C1<C2<<CyN1 \le C_1 < C_2 < \dots < C_{y} \le N
  • 序列 BBCC 不相同。
    • 在这里,当 xyx ≠ y 或存在一个整数 i (1imin(x,y))i\ (1 ≤ i ≤ \min(x, y)) 使得 BiCiB_i ≠ C_i 时,我们认为 BBCC 是不同的序列。
  • AB1+AB2++ABxA_{B_1} + A_{B_2} + \dots + A_{B_x}AC1+AC2++ACyA_{C_1} + A_{C_2} + \dots + A_{C_y}200200 取模后的结果相等。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

You are given a sequence of NN positive integers: A=(A1,A2,,AN)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.

  • 1x,yN1 ≤ x, y ≤ N.
  • 1B1<B2<<BxN1 \le B_1 < B_2 < \dots < B_{x} \le N.
  • 1C1<C2<<CyN1 \le C_1 < C_2 < \dots < C_{y} \le N.
  • BB and CC are different sequences.
    • Here, we consider BB and CC different when xyx ≠ y or there is an integer i (1imin(x,y))i\ (1 ≤ i ≤ \min(x, y)) such that BiCiB_i ≠ C_i.
  • AB1+AB2++ABxA_{B_1} + A_{B_2} + \dots + A_{B_x} and AC1+AC2++ACyA_{C_1} + A_{C_2} + \dots + A_{C_y} are equal modulo 200200.

Constraints

  • All values in input are integers.
  • 2N2002 \le N \le 200
  • 1Ai1091 \le A_i \le 10^9

Input

Input is given from Standard Input in the following format:

NN

A1A_1 A2A_2 \dots ANA_N

Output

If there is no pair of sequences B,CB, C satisfying the conditions, print a single line containing No.

Otherwise, print your choice of BB and CC in the following format:

Yes

xx B1B_1 B2B_2 \dots BxB_x

yy C1C_1 C2C_2 \dots CyC_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)B=(1),C=(3,4), we have A1=180, A3+A4=380A_1 = 180,\ A_3 + A_4 = 380, which are equal modulo 200200. 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.

update @ 2024/3/10 09:11:52