why my submission is TLE?

Правка en1, от crozzhtt, 2021-08-07 08:43:33

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

Summary: for n strings, the task is to combine those strings into one large string, and when merging the 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 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.net/contest/1200/submission/125065146

Thanks a lot!

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский crozzhtt 2021-08-07 08:47:50 69
en2 Английский crozzhtt 2021-08-07 08:44:49 10 Tiny change: ' with the current s' -> ' with the prefix of current s'
en1 Английский crozzhtt 2021-08-07 08:43:33 818 Initial revision (published)