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

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

Can someone please explain the tutorial(or any other approach) of the problem 808G - Гимн Берляндии .I am not able to understand the tutorial.

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

»
4 года назад, # |
Rev. 3   Проголосовать: нравится +5 Проголосовать: не нравится

You can solve an easier version of that problem first here from CSES & my solution in case you need. Some idea about it's approach can be found in comments of this post.
After solving the above problem from cses, you can apply the same logic, the only different thing you need is to quickly find where you will land if you try placing characters 'a' to 'z' at some index where there is a '?'. For that you can build an automaton from prefix function as described here.