Getting WA in http://www.codechef.com/problems/STRQ
My code : http://www.codechef.com/viewsolution/7019588
Cant understand why WA.
Please help. Thanks in advance
Getting WA in http://www.codechef.com/problems/STRQ
My code : http://www.codechef.com/viewsolution/7019588
Cant understand why WA.
Please help. Thanks in advance
for c h 2 3 your code should print 1, but it prints 2
You may try this case now -
for c f 1 10 you are getting wrong answer , try it !
Since u are getting TLE for subtask 2 you may try mine brute force approach as i am also not good in Dp.
What I did is for eg. this case c f 1 10 , traverse from 1 to 10 and if you encounter character as ācā then increment count of c and whenever u encounter āfā increment count of cf as cf=cf+c because count of strings starting with c and ending at f will depend on count of ācā always, hope u understand.
My Solution - http://www.codechef.com/viewsolution/6202702
yes,your code is nice.But why my code is not working?
Strange!!
You are now missing a very basic case
h f 1 2
for h f 1 2 your code gives output in my system as 33 which is wrong, either their is problem in initialization of your variables.