Strange behaviour and TLE on small test cases

It’s TICTACTOE bugaboo from a recent CodeChef contest and it’s showing TLE on the first 2 subtasks and the majority of test cases of subtasks 3 are perfectly passing…
I have spent the whole day debugging it out but all got in vain, hope I get some help from this wonderful community.
Thanks in advance.
Solution Link:

ACfied code , just commented the memset dp part and set them manually to 0.

Sir could you pls explain what was the reason for this???
And thanks a lot!

There is no such big reason as per my knowledge . You just needed to reduce the Time which I did by not using memset and doing it manually.

1 Like