Memory limit exceeded on 535D

Правка en1, от code_kit, 2017-12-15 22:06:37

Hi guys, Am trying to solve this problem http://mirror.codeforces.com/problemset/problem/535/D. My algorithm is create a string which fits the given condition. i.e. vector of vector of chars. And use the Z algorithm to compute the longest prefix starting from the indexes given in the statement and check if it is atleast as length as p. But to my suprise i am getting memory limit exceeded on test 3 and i could not figure out what is going on here. Can someone plz tell me. My solution is https://ide.geeksforgeeks.org/9nrDUDjby6. Thanks

Теги #strings, z algorithm, kmp

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский code_kit 2017-12-15 22:06:37 561 Initial revision (published)