#P15453. [JOI 2026 SemiFinal] 衣服 / Clothes

    ID: 17494 远端评测题 2000ms 1024MiB 尝试: 0 已通过: 0 显示难度普及+/提高− 上传者: 标签>Special JudgeJOI(日本)2026

[JOI 2026 SemiFinal] 衣服 / Clothes

Problem Description

Beaver Bitaro plans to buy at least 00 pieces of clothes at a clothing store. The store sells a total of 100100 types of clothes, numbered from 11 to 100100. The stock of every type is sufficient, so no matter how many pieces Bitaro buys, they will not be sold out.

Bitaro can adjust his perceived temperature by wearing the clothes he bought. When the air temperature is tt degrees and Bitaro is wearing kk pieces of clothes of types s1,s2,…,sks_1, s_2, \dots, s_k, his perceived temperature is t+s1+s2+⋯+skt + s_1 + s_2 + \cdots + s_k. Note that Bitaro may choose to wear any number of pieces (00 or more) of clothes (if he wears no clothes, i.e., k=0k = 0, then his perceived temperature is tt degrees). Also, he may wear multiple pieces of the same type at the same time; for each additional piece of that type, the perceived temperature increases by the number of that type.

From the weather forecast, Bitaro learns that the temperatures over the next NN days are A1A_1 degrees, A2A_2 degrees, …\dots, ANA_N degrees, in this order. He wants to buy clothes in a suitable way so that on any of the next NN days, he can choose what to wear so that his perceived temperature becomes exactly 2323 degrees. Moreover, if such a buying plan exists, he wants the total number of pieces he buys to be as small as possible.

Given the temperatures for the next NN days, write a program to determine whether there exists a way to buy clothes such that on every day he can adjust his perceived temperature to exactly 2323 degrees. If it exists, output one specific buying plan that minimizes the number of pieces bought.

Input Format

The input is given from standard input in the following format:

NN
A1 A2 ⋯ ANA_1\ A_2\ \cdots\ A_N

Output Format

Output to standard output in the following format.

If there is no buying plan that allows Bitaro to adjust his perceived temperature to 2323 degrees on every day, output No.

If such a buying plan exists, output Yes on the first line. Next, let the minimum number of pieces to buy be kk, and the types of the kk pieces bought be s1,s2,…,sks_1, s_2, \dots, s_k. Then output kk on the second line, and output kk integers s1,s2,…,sks_1, s_2, \dots, s_k separated by spaces on the third line. These kk integers may be output in any order. If there are multiple buying plans that satisfy the conditions, you may output any one of them.

3
17 20 23
Yes
2
3 3
1
24
No

Hint

Sample Explanation 1

By buying 22 pieces of type 33 clothes, Bitaro can, on any of the next 33 days, choose what to wear so that his perceived temperature becomes 2323 degrees. Specifically:

  • Day 11: Wear 22 pieces of type 33 clothes.
  • Day 22: Wear 11 piece of type 33 clothes.
  • Day 33: Wear no clothes.

Buying 11 piece or fewer cannot make it possible to adjust the perceived temperature to 2323 degrees on every one of the next 33 days.

This sample input satisfies the Constraints of subtasks 2,4,5,6,72,4,5,6,7.

Sample Explanation 2

On the day when the air temperature is 2424 degrees, it is impossible to make the perceived temperature become 2323 degrees. Therefore, no matter how clothes are bought, it is impossible to adjust the perceived temperature to 2323 degrees on every one of the next 11 day.

Constraints

  • 1≤N≤811 \le N \le 81
  • −40≤Ai≤40-40 \le A_i \le 40 (1≤i≤N1 \le i \le N)
  • Ai<Ai+1A_i < A_{i+1} (1≤i≤N−11 \le i \le N-1)
  • All input values are integers.

Subtasks

  1. (6 points) N=1N = 1
  2. (14 points) N≤3N \le 3
  3. (15 points) Ai+1=Ai+1A_{i+1} = A_i + 1 (1≤i≤N−11 \le i \le N-1), and AN=23A_N = 23
  4. (16 points) Ai≥12A_i \ge 12 (1≤i≤N1 \le i \le N)
  5. (9 points) Ai≥4A_i \ge 4 (1≤i≤N1 \le i \le N)
  6. (21 points) Ai≥−8A_i \ge -8 (1≤i≤N1 \le i \le N)
  7. (19 points) No additional constraints.

Translated by DeepSeek.

Translated by ChatGPT 5