Hello,
I'm having a hard time trying to solve this problem. I've already tried three different solutions, using Hash, Aho-Corasick and Suffix Array (O(n) implementation + Longest Common Prefix) respectively. However, I keep getting TLE, as the time limit is too tight and they don't use optimization flags to compile on this site.
Notice that this problem is also available on LiveArchive. I got AC there using Hash or Aho-Corasick and even managed to be among the top solutions. However, apparently there is a much faster way of solving this problem. Could anyone help me with other ideas?
Thanks!