razerx100's blog

By razerx100, history, 7 days ago, In English,

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

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

»
7 days ago, # |
  Vote: I like it 0 Vote: I do not like it

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?

  • »
    »
    7 days ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    I thought the prices were unique.So I used i to create a new array with answers and iter would iterate through the previously sorted array and increase the shops number. I guess this wouldn't work with duplicate values. Anyway, thanks for replying. Much appreciated. Hopefully I will be able to fix it now. Edit: worked 81057331