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

Revision ru5, by 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]

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
ru5 Russian SirodgevAlexander_ 2024-02-11 12:54:12 1163
ru4 Russian SirodgevAlexander_ 2024-02-11 12:53:16 18
ru3 Russian SirodgevAlexander_ 2024-02-11 12:52:39 4 Мелкая правка: 'n(s);\n\n}~~~~~\n\n[' -> 'n(s);\n\n}\n\n~~~~~\n\n['
ru2 Russian SirodgevAlexander_ 2024-02-11 12:52:13 1177
ru1 Russian SirodgevAlexander_ 2024-02-11 12:49:35 314 Первая редакция (опубликовано)