Question: C++ Language Alan decided to get in shape for the summer, so he created a precise workout plan to follow. His plan is to go


![days and lift X[i] grams on day i. In order to improve](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f31ce73b6ff_67866f31ce6d0561.jpg)
Alan decided to get in shape for the summer, so he created a precise workout plan to follow. His plan is to go to a different gym every day during the next N days and lift X[i] grams on day i. In order to improve his workout performance at the gym, he can buy exactly one pre-workout drink at the gym he is currently in and it will improve his performance by A grams permanently and immediately. In different gyms these pre-workout drinks can cost different amounts C[i] because of the taste and the gym's location but its permanent workout gains are the same. Before the first day of starting his workout plan, Alan knows he can lift a maximum of K grams. Help Alan spend a minimum total amount of money in order to reach his workout plan. If there is no way for him to complete his workout plan successfully output -1. Input The first one contains two integer numbers, integers N (1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
