backtrack is sufficient to solve this problem. i solved this prob using backtrack in 0.072 sec.


Moderator: Board moderators
Fair enough. It is always legitimate to find a solution that the problem setter did not have in mind. For this problem there have been several, including faster and slower solutions.Per wrote:Indeed it does! I hadn't even had the energy to try it because I thought it would be too slow, but I just coded it up and it worked very well. Thanks for the hint!
Now that I think of it, it isn't that strange. But that's always easy to say afterwards.