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

Автор REtoAC2001, история, 3 года назад, По-английски

While writing a recursive solution to the problem https://codeforces.net/contest/1389/problem/B I didn't take count (which is the number of steps taken till now) into account in the dp states. But now that I think of it ,I wonder why doesn't the dp(recursion) depend on the no of steps left.
Here is the link to my submission :https://codeforces.net/contest/1389/submission/122378801. Here idx represents the present index we are currently in, check denotes whether the last move was left(1) or right(0) and mleft is count of moves to the left we have taken so far. Can anyone help me understand why is it independent on the no of steps taken/left.

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

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

Have you seen the editorial at https://codeforces.net/blog/entry/80809? I haven't read over your code but from the editorial you can see that DP isn't even needed for this problem.