#C8724. Food Packets Distribution
Food Packets Distribution
Food Packets Distribution
You are given a total number of food packets P and three types of recipients: adults, teenagers, and children. Each adult requires 2 packets, each teenager requires 1 packet, and each child requires \(0.5\) packet. For every test case, determine if it is possible to meet these minimum requirements.
If the available packets P is at least the sum of the minimum required packets, output the allocated packets for adults, teenagers, and children as three space-separated integers. Here, the allocation for adults is exactly 2 \(\times\) number of adults, for teenagers is exactly the number of teenagers, and for children is \(\lfloor\frac{children}{2}\rfloor\) (i.e. the integer part of half the children count). If P is insufficient to meet the minimum requirement, output "Not Possible".
Note: The calculation for the required packets is given by:
\[ \text{required} = 2 \times a + 1 \times t + 0.5 \times c \]Even if there are extra packets beyond the minimum requirement, the distribution will only allocate the minimum needed packets.
inputFormat
The first line contains an integer T, representing the number of test cases. Each of the next T lines contains four space-separated values: P a t c, where P is the total number of food packets, a is the number of adults, t is the number of teenagers, and c is the number of children.
Read input from stdin.
outputFormat
For each test case, output a single line. If it is possible to meet the minimum packet requirement, output three space-separated integers: the number of packets allocated to adults, teenagers, and children (in that order). Otherwise, output "Not Possible".
Write output to stdout.
## sample3
100 20 30 40
10 5 2 1
50 0 10 80
40 30 20
Not Possible
0 10 40
</p>