Editorial for TLE '16 Contest 7 P6 - Everyone Hates Reading
Submitting an official solution before solving the problem yourself is a bannable offence.
This problem is a simple string problem that requires the use of a trie. There are two possible approaches:
- Store the indices of each string inside the trie, then binary search the lower and upper bounds in each query
- Use a persistent trie and do two queries, one on the trie and one on the trie.
Unfortunately, there was not sufficient data to prevent incorrect (hashing) solutions from passing. Due to this, the problem can be solved in a trivial way. However, it is encouraged to use a proper solution instead of abusing the test data.