The Vouchers#6

The Vouchers (Discussion)

  1. AndremaxicoJan 19, 2025, 11:41 AM

    How can it be 232 max if it can be 262 and 247?

    1. Viacheslav_ShevcenkoFeb 16, 2025, 3:06 PM

      Andremaxico How did you manage to get such results? Maybe you misunderstood the problem. Here are a few possible outcomes in the example:

      • Selling first, second, third, then fourth ticket respectively: max(2 - 0, 0) * 37 + max(3 - 1, 0) * 45 + max(1 - 2, 0) * 46 + max(4 - 3, 0) * 30 = 194

      • Selling fourth, third, second, then first ticket respectively:max(4 - 0, 0) * 30 + max(1 - 1, 0) * 46 + max(3 - 2, 0) * 45 + max(2 - 3, 0) * 37 = 165

      • Selling second, first, fourth, then third ticket respectively(the maximum possible result):max(3 - 0, 0) * 45 + max(2 - 1, 0) * 37 + max(4 - 2, 0) * 30 + max(1 - 3, 0) * 46 = 232

  2. ilkinimanovNov 9, 2024, 6:23 PM

    How can I implement dynamic programming algorithm on this question? There is dynamic programming tag in this question

    1. objective_tesla_956Jan 12, 2025, 7:25 AM

      ilkinimanov You are asking for the answer

      The problem is interesting for this part how to make connectivity between numbers and implement it in dynamic programming.