aniket20's blog

By aniket20, history, 9 years ago, In English

Can anyone tell me how to solve this question codeforces.com/gym/100624/problem/E

Thanks in advance.

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

»
9 years ago, # |
Rev. 2   Vote: I like it +8 Vote: I do not like it

Here's my idea, though it might be slight overkill.

For each symbol, precompute its prefix and suffix of length at most 2000. Then, create the following recursive procedure:

Link because I don't know how to format comments on here