Help in Topcoder DP problem

Revision en1, by purple_dreams, 2017-05-25 07:54:38

Here is the link: RoadOrFlightHard I got the solution but it takes dp[400000][40][2] which is very huge as far as memory is concerned. In the editorial they have added a line that city(i) calculation depends on city(i+1). I was not able to get that observation and I am not getting how to implement it. I saw one code but still did not understand. Thank You.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English purple_dreams 2017-05-25 07:54:38 464 Initial revision (published)