I was trying to solve the problem Key Task
Link: spoj.pl/problems/CERC07K/
My approach was as follows:
My code passed the sample test cases. But, when I submit it, I am getting TLE. Can someone please tell me if there are other ways of pruning the search tree?
I have posted my code below. Though it might look big, there are lot of redundancies which do almost similar operations with little difference.
Thanks-
Karthick
Code Accepted !