just_try_again's blog

By just_try_again, history, 2 years ago, In English

Hey guys, I've been trying various approaches for this problem which appeared in this contest (ended). I submitted many solutions with different DP states but even my best solution gives me TLE on half of the test cases. My DP states are 'n' and the current number under consideration for the sequence, say 'i'. For each dp[n][i], I consider all cases, from the inclusion of no 'i' to the max number of times that 'i' can be included in the sequence.

I request you to share your approach(es) to this problem, please.

My submission — link

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it