Editorial for 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.
Author:
Task MULTIGRAM
Let there be given a string of length . We can iterate over all divisors of number and check whether it’s possible for a string to consist of anagrams of length .
In order to check this, we need to determine whether the substrings are mutually anagrams.
It is sufficient to sort all these strings and check if they’re equal then.
Necessary skills: strings
Category: ad-hoc
Comments