I have been trying to do 706B - Interesting drink . I know I can do this with Binary Search but I am trying to do it with DP. Anyway my submission 81044174 fails on 5th test. For some reason all of my outputs are 5's. I can't understand why. Since I can't see the inputs either I can't debug. Only thing I can think of is my iter pointer going insane. Nothing else coming to my mind. Any help would be appreciated. Thanks
It doesn't seem like the shop prices have to be unique. So, checking
if(i == *iter)
might be wrong.Also, what is the point of keeping both an iterator and an index?