(I even saw some people's programs that ran within 2 seconds during the contest.

Thank you
Moderator: Board moderators
No, why should we? If we have the letters a, c, a, d, we can build the words acad, cada, aadc..., regardless of the letter order within a word. So if the dictionary contains the word cada, we simply record it as aacd (that is, we sort the word).You say we can consider just 2^p words and look for them in dictionary but,shouldn't we consider every permutation of this 2^p words?
Code: Select all
cut after i found my silly mistake