Why this isn't 1-D dp ?

Правка en1, от kaiyu, 2020-05-10 17:39:30

Problem Link:

https://www.codechef.com/problems/GRHARSH

I see all the solutions have 2D dp solution.

I was thinking dp[i] = max gold at the time i.

Is this correct? If it is, can somebody post the correct 1D dp code in the comment section?

And can someone explain the 2D solution as well? Thank you!

Теги #2d-dp, #dp, 1d-dp, #dynamic programing

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский kaiyu 2020-05-10 18:13:26 130
en1 Английский kaiyu 2020-05-10 17:39:30 339 Initial revision (published)