P15453 [JOI 2026 SemiFinal] Clothes / Clothes

Description

Beaver Bitaro plans to buy at least $0$ pieces of clothes at a clothing store. The store sells a total of $100$ types of clothes, numbered from $1$ to $100$. 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 $t$ degrees and Bitaro is wearing $k$ pieces of clothes of types $s_1, s_2, \dots, s_k$, his perceived temperature is $t + s_1 + s_2 + \cdots + s_k$. Note that Bitaro may choose to wear any number of pieces ($0$ or more) of clothes (if he wears no clothes, i.e., $k = 0$, then his perceived temperature is $t$ 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 $N$ days are $A_1$ degrees, $A_2$ degrees, $\dots$, $A_N$ degrees, in this order. He wants to buy clothes in a suitable way so that on any of the next $N$ days, he can choose what to wear so that his perceived temperature becomes exactly $23$ 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 $N$ 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 $23$ 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: $N$ $A_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 $23$ 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 $k$, and the types of the $k$ pieces bought be $s_1, s_2, \dots, s_k$. Then output $k$ on the second line, and output $k$ integers $s_1, s_2, \dots, s_k$ separated by spaces on the third line. These $k$ integers may be output in any order. If there are multiple buying plans that satisfy the conditions, you may output any one of them.

Explanation/Hint

#### Sample Explanation 1 By buying $2$ pieces of type $3$ clothes, Bitaro can, on any of the next $3$ days, choose what to wear so that his perceived temperature becomes $23$ degrees. Specifically: - Day $1$: Wear $2$ pieces of type $3$ clothes. - Day $2$: Wear $1$ piece of type $3$ clothes. - Day $3$: Wear no clothes. Buying $1$ piece or fewer cannot make it possible to adjust the perceived temperature to $23$ degrees on every one of the next $3$ days. This sample input satisfies the Constraints of subtasks $2,4,5,6,7$. #### Sample Explanation 2 On the day when the air temperature is $24$ degrees, it is impossible to make the perceived temperature become $23$ degrees. Therefore, no matter how clothes are bought, it is impossible to adjust the perceived temperature to $23$ degrees on every one of the next $1$ day. ### Constraints - $1 \le N \le 81$ - $-40 \le A_i \le 40$ ($1 \le i \le N$) - $A_i < A_{i+1}$ ($1 \le i \le N-1$) - All input values are integers. ### Subtasks 1. (6 points) $N = 1$ 2. (14 points) $N \le 3$ 3. (15 points) $A_{i+1} = A_i + 1$ ($1 \le i \le N-1$), and $A_N = 23$ 4. (16 points) $A_i \ge 12$ ($1 \le i \le N$) 5. (9 points) $A_i \ge 4$ ($1 \le i \le N$) 6. (21 points) $A_i \ge -8$ ($1 \le i \le N$) 7. (19 points) No additional constraints. Translated by DeepSeek. Translated by ChatGPT 5