crozzhtt's blog

By crozzhtt, history, 3 years ago, In English

Hello everyone, I have 1 question for my submission to the problem: https://codeforces.com/problemset/problem/1200/E

Summary: for n strings, the task is to combine those strings into one large string, and when merging two strings, remove the longest prefix of the second string that duplicate with the suffix of the first string.

Solution idea: I create a variable to store the resulting string after each iteration, so when it comes to the i-th string, I will compare the suffix of the resulting string with the prefix of current string by hashing. However, I don't understand why my submission gets TLE , because I think my algorithm is O(n), so I need your help. This is my TLE submission for this problem: https://codeforces.com/contest/1200/submission/125065146

Thanks a lot! <Sorry for my poor english,I use Google translate for this post.>

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?