Reconstruct N from K Statistics (constructive/exam-style)

EXTREME · C · 5000ms

As a final riddle, the mentor gives Fahim only three clues about a hidden set of N numbers — their sum, their product, and their maximum — and challenges him to reconstruct any set of numbers that fits. You are told: the sum of N positive integers is S, their product is Pr, and the maximum is M. Determine whether such a set of N positive integers can exist, and if so, output one valid example (any valid array). This is a constructive reasoning problem — think about the tightest possible bounds (e.g. what's the minimum possible sum given N-1 values of 1 and one value M?) before coding a search.

Input

Three integers N S Pr M on one line.

Output

"NO" if impossible, otherwise "YES" followed by N integers forming a valid example.

Constraints

1 ≤ N ≤ 20, 1 ≤ S, Pr, M ≤ 10^9

Sample Input

3 6 6 3

Sample Output

YES
1 2 3
main.c
Loading editor…

Write C, then Run (custom I/O) or Submit (sample tests). ⌘/Ctrl+Enter submits.

Reconstruct N from K Statistics (constructive/exam-style) · DIU ContestHub