Wrong ans TACHEMIS

http://www.codechef.com/problems/TACHEMIS/

I am getting a wrong answer everytime but I have checked a lot of cases and the code runs fine on them
Can anyone help me regarding this. Thanx in advance

http://www.codechef.com/viewsolution/2402730

During checking for each segment if it is in the middle of a palindrome.
U should stop the search whenever the segment to its right is not equal to the first segment to its left (case: alpha[i-j] != alpha[i+j])
as it is not possible to make any palindromes in this case

Example

A,3

B.2

C,3

D,2

A,3

In this test case, when u start searching using (C,3) as the middle segment

You compare (B,2) and (D,2) which are not equal (B!=D)

You should stop the search at this moment

because if you continued, you will check (A,3) and (A,3) and count that as a palindrome while it is not.

1 Like

Thanx a lot for the answer
Yes that was indeed something i missed But still I am getting wrong ans…Am I still missing something??
http://www.codechef.com/viewsolution/2403770

I cannot say about wrong answer but you will surely get a TLE since you have not applied Manacher properly , as for case :
1
1
a 1000000000

one reason of getting WA is also that you r not flushing the memory…