← Back to topics
Topic

111 z-palindromes

f
fushar
The first sample input of this problem is:
I'm excited with my dad's 111 solved problems on Z-trening!


Surprisingly, this is the 111st problem I solve!
Ahahahaha.... this is REALLY a coincidence....
A
Asmirasmir
Hmm , can you help me with this task , i assume that i must use DP to solve this one , but i just don't know how to do it. Could you give me some advice or pseudo code or link?
f
fushar
No, I didn't use DP. Just parse all the words and check if a word is a palindrome!
A
Asmirasmir
Tnx , I've recoded my solution , but i still get 2 Tles and 3 WA , can you look at my code and help me a bit ?

http://www.z-trening.com/new/www/html/submit.php?subm_stat=1&submit=7100050937
f
fushar
Try this very simple testcase:
a

Your program outputs 0; it should be 1.
To get rid of those TLEs, avoid using string class. Use char[] instead.
A
Asmirasmir
thanks , passed all of the tests after a bunch of fails more xD.
For anyone else that needs help:
You better go with cstring and functions , stl is just a tad too slow.
try some cases like a,aba...