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

Автор darkworld1, история, 6 лет назад, По-английски

Hello , i got stuck with the problem of dp where , i was not able to build dp state ? Link of the problem is https://atcoder.jp/contests/abc122/tasks/abc122_d

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

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

Keep the position and last three letters in the dp state. For each new letter, check if old three letters + new letter doesn't violate the rules. Then you can calculate the dp easily. I would prefer to implement recursively as it looks like a dfs.