Recently I solved this problem. Upon first reading this and before solving it, I thought of many other possible approaches like which would either TLE/MLE. One of them being to maintain a dp; Until I finally realized the retroactiveness the question demands. If you look at it closely it is the same as this problem. Now I have a few questions on how to solve a more general version of it if...
1 The A was variable i.e. we are also given an array each having some A[i] with atmost one drink per day.
2 Instead of atmost 1 drink per day, We are allowed to choose any number of drinks per day with given A[i]'s
If you have any thoughts or ideas on this one please make sure to share. As for me, it is the first time I have seen such variations in such a problem with these constraints. Also can we even solve it in some efficient complexity ? I am very eager to know.
Thanks for reading !