time limit exceeded on O(n) Z-func in problem below

Правка ru5, от SirodgevAlexander_, 2024-02-11 12:54:12

Hello!

I have TLE on 23 test with O(n) (I think so) Z-function. I want to reverse origin string and just use Z-func. Where is the problem?

code below https://gist.github.com/BigTape/2506b276900a6fea04d051bc4062c1f6

[problem:https://codeforces.me/edu/course/2/lesson/3/4/practice/contest/272262/problem/D]

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
ru5 Русский SirodgevAlexander_ 2024-02-11 12:54:12 1163
ru4 Русский SirodgevAlexander_ 2024-02-11 12:53:16 18
ru3 Русский SirodgevAlexander_ 2024-02-11 12:52:39 4 Мелкая правка: 'n(s);\n\n}~~~~~\n\n[' -> 'n(s);\n\n}\n\n~~~~~\n\n['
ru2 Русский SirodgevAlexander_ 2024-02-11 12:52:13 1177
ru1 Русский SirodgevAlexander_ 2024-02-11 12:49:35 314 Первая редакция (опубликовано)