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

Автор ArepitaDePernil, 12 лет назад, По-английски

Hello i have solved this problem kind of the same way i solved UVA 10003 — Cutting Sticks , after solving Cutting Sticks i did some research and find out about the Knuth-Yao optimization, even if i did not understand the code as a whole, i knew the basic condition and the answer, so i just plugged and played the code and got a very fast accepted con Cutting Sticks. As UVA 10688- The Poor Giant can be solve in a similar way to Cutting Sticks and obviously the condition dp[a][b-1]<=dp[a][b]<=dp[a+1][b] holds , can somebody tell me a way to manipulate the knuth-yao basic code to give right answer to this problem? :)

Of course a little explanation about the main Knuth-Yao code will also help a lot , thanks !!!

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

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

You said that "obviously the condition dp[a][b-1]<=dp[a][b]<=dp[a+1][b] holds". This is incorrect for this problem. Just because it seems like it works doesn't mean it actually does. Specifically this breaks on the 3rd sample case. However a different type of optimisation works.