cs1190380's blog

By cs1190380, history, 2 months ago, In English

Can someone please explain the tutorial(or any other approach) of the problem 808G - Anthem of Berland .I am not able to understand the tutorial.

 
 
 
 
  • Vote: I like it
  • -20
  • Vote: I do not like it

»
2 months ago, # |
Rev. 3   Vote: I like it +5 Vote: I do not like it

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.