#K12806. Water Distribution Challenge
Water Distribution Challenge
Water Distribution Challenge
You are given three integers:
- n: the number of containers,
- k: the total units of water to distribute,
- m: the maximum capacity of each container.
Your task is to determine if it is possible to distribute exactly k
units of water among the n
containers such that no container receives more than m
units of water. If a valid distribution exists, output any one such distribution as n
integers (each integer representing units of water in the corresponding container) separated by spaces. Otherwise, output No
.
The validity criteria are given by the inequality
\[
k \le n \times m
\]
and the sum of the distributed water must exactly equal k
while each container’s allocation does not exceed m
.
inputFormat
The input is read from standard input. It consists of a single line containing three space-separated integers: n
, k
, and m
.
outputFormat
If a valid distribution exists, print a single line containing n
integers separated by a single space that represent a valid allocation of water to the containers. If it is impossible to distribute the water under the given constraints, print No
.
5 10 3
3 3 3 1 0