#P15453. [JOI 2026 SemiFinal] 衣服 / Clothes
[JOI 2026 SemiFinal] 衣服 / Clothes
Problem Description
Beaver Bitaro plans to buy at least pieces of clothes at a clothing store. The store sells a total of types of clothes, numbered from to . 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 degrees and Bitaro is wearing pieces of clothes of types , his perceived temperature is . Note that Bitaro may choose to wear any number of pieces ( or more) of clothes (if he wears no clothes, i.e., , then his perceived temperature is 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 days are degrees, degrees, , degrees, in this order. He wants to buy clothes in a suitable way so that on any of the next days, he can choose what to wear so that his perceived temperature becomes exactly 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 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 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:
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 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 , and the types of the pieces bought be . Then output on the second line, and output integers separated by spaces on the third line. These 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 pieces of type clothes, Bitaro can, on any of the next days, choose what to wear so that his perceived temperature becomes degrees. Specifically:
- Day : Wear pieces of type clothes.
- Day : Wear piece of type clothes.
- Day : Wear no clothes.
Buying piece or fewer cannot make it possible to adjust the perceived temperature to degrees on every one of the next days.
This sample input satisfies the Constraints of subtasks .
Sample Explanation 2
On the day when the air temperature is degrees, it is impossible to make the perceived temperature become degrees. Therefore, no matter how clothes are bought, it is impossible to adjust the perceived temperature to degrees on every one of the next day.
Constraints
- ()
- ()
- All input values are integers.
Subtasks
- (6 points)
- (14 points)
- (15 points) (), and
- (16 points) ()
- (9 points) ()
- (21 points) ()
- (19 points) No additional constraints.
Translated by DeepSeek.
Translated by ChatGPT 5