Candy Machine - Baltic OI

Link
I am not sure how to approach the solution to this problem. The solution talks about a 20% correct dp solution which takes O(n^w). I can’t really come up with this solution and it would be great if someone pointed me in the right direction. I think once I can figure this solution out, I can move forward with the faster ones.

1 Like