Editorial for COCI '15 Contest 5 #2 Multigram
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Let there be given a string of length
We can iterate over all divisors
In order to check this, we need to determine whether the substrings
It is sufficient to sort all these strings and check if they're equal then.
Comments