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

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

Hello everyone, I am trying this DP problem on my own, I am using Memoization. Most of the test cases work fine, but I don't know why I am getting a wrong answer. Can anyone please point out my mistake? Also this is my first time posting here, so if I make any mistake, I apologise in advance.

Problem link — https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=977) my code — https://pastebin.com/LddwmQRc

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

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Well, what if the value of n will be less than the value of k? Some of your dp[i] states will still be true.