Блог пользователя deepak_097

Автор deepak_097, история, 5 лет назад, По-английски

Please help me to solve this problem — link

Please mention this kind of problems in comment section.

Contest link — link

Thank you :)

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
5 лет назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится
  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Can you please explain the logic how to store dp[x][y].I am unable to understand the logic mentioned in the above link comment section.

    • »
      »
      »
      5 лет назад, # ^ |
        Проголосовать: нравится +8 Проголосовать: не нравится

      You can apply the knapsack type DP approach to fill the table. The main logic For finding DP[x][i] you can take j = 1 to i values from current DP and take remaining (i-j) values from it's child DP and update current DP.