WA in SPOJ: PLD

Here is this spoj Problem

i am using manacher’s algorithm for finding palindromic substring
but getting WA, can somebody tell where i am wrong?

Here is link to my code…

1 Like

Your solutions give wrong answer to almost all the test cases.

example:

input

2
abbaabbacaacfguiuoppo

your output is 0 while correct answer is 5

input

3
abbbaaabbbbaaaaaabbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbb

your output is 10 while correct answer is 65.

input

2
aaaaa

your output is 2 while correct answer is 4.

hope it help to find bug in your program.

enjoy happy coding :slight_smile:

3 Likes

thanks… after little modification got AC…

1 Like

pleasure is mine :slight_smile:

wat modification can u tell me

change sign == to >= :smiley:

My code gives the correct answer for the all testcases mentionend above but it’s still wa :frowning:

my code: http://ideone.com/o2GMTa

What logical mistake did I make?

Thanks in advance! :smiley:

I did not use Manacher’s Algorithm, instead I used Rabin Karp.

//