444iq's blog

By 444iq, history, 7 months ago, In English,

answer will be 65 for the 2nd test case?

input 3.

1 , 2 , 4 , 8. and b = 3

fill 1 litre on day 1 and 3 on day 2 , total cost = 7.

my greedy approach of taking as much as we can in a given range with minimum cost fails.

my idea for input 3, fill 3 on day 1, and 1 on day 4 but it gives a cost of 11 which is not optimal.

 
 
 
 
  • Vote: I like it
  • -8
  • Vote: I do not like it