This is my code for [TWODOGS][1] in this February Long Challenge.
[2]
For number of inputs I tried, I am getting correct answer but on submitting I get WA. Please help for which cases this code doesn't work.
[1]: http://www.codechef.com/FEB14/problems/TWODOGS
[2]: http://www.codechef.com/viewsolution/3435634
It’s quite difficult to point out the bug in your program! Still try this test case
Test Case:
5 4
1 3 3 2 1
Your O/P: 3
Actual O/P: 2
Maybe you are not checking the time for all required combinations in the array! You are missing the combination of 1 on first position and 3 on second position. You only calculated the time of 1 on first position and 3 on third position.