LCC '21 Contest 5 J2 - Bottle Refilling
View as PDFJustin is using his new water bottle, which has a strange trick, it can automatically refill itself! The bottle is liters in volume and originally full, and Justin will drink
liters from it on day
. The bottle will refill itself at the end of the day to
liters if the amount of water left is less than or equal to
.
Can you figure out on which days the bottle refills itself? Or, if the amount Justin drinks is more than what is left in the bottle, output Impossible.
Input Specifications
The first line will contain integers ,
and
, the volume of the bottle, the number of days, and the volume at where the bottle will refill itself, respectively.
The next lines will contain 1 integer
, representing how many liters Justin drank on day
.
Output Specifications
If there are any days where Justin drinks more liters than what is left in the bottle, output Impossible.
Otherwise, output the days where the bottle will refill itself.
Sample Input 1
10 5 2
6
2
3
4
3
Sample Output 1
2
5
Sample Explanation 1
On day 2, Justin drank a total of 8 liters from his water bottle, leaving 2 liters left so the bottle will refill. After that, Justin drank a total of 10 liters, so the bottle will refill again on day 5.
Sample Input 2
9 4 3
4
1
5
2
Sample Output 2
Impossible
Comments