code_kit's blog

By code_kit, history, 7 years ago, In English

Hi guys, Am trying to solve this problem http://codeforces.net/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

  • Vote: I like it
  • -6
  • Vote: I do not like it