Блог пользователя Rupai

Автор Rupai, 14 лет назад, По-английски

http://www.spoj.pl/problems/EPALIN/

I use KMP. First generate failure function reverse of the string that given to me, then do KMP search to find largest suffix of the string that match with the prefix of the reverse string.

But I am not able to find anything wrong in my implementation. Can anybody please tell me why it's getting TLE??? Below is my cpp source code:

Edit: Got AC
  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
14 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

You've just need to find Prefix function of last character of string rstr + # + str, let it be PR, and then output str and first len - PR chars of str in reverse order.

»
8 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

help... getting WA any corner cases.... https://ideone.com/EknGW8

thanku