ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1298. Knight

Hint
Posted by ASK 22 Feb 2010 21:12
http://delphiforfun.org/Programs/knights_tour.htm

A technique known as  Warnsdorf's heuristic allows us to make much better choices for next move than random selection.  The heuristic, discovered by H. C. von Warnsdorf in 1823 tells us to select as our next move  the one which has the fewest choices for moving on from there.  This heuristic works so well that , although I have implemented backtracking to remove bad choices, I have yet to see a move retracted while making a tour
Re: Hint
Posted by MOPDOBOPOT (USU) 19 Nov 2012 23:35
Warnsdorf's idea works in linear time!
Amazing power of human mind.. :)
Re: Hint
Posted by Erop [USU] 20 Nov 2012 02:16
Try to solve a little bit more difficult version of the problem ;)
1596. Knight Mare ( http://acm.timus.ru/problem.aspx?space=1&num=1596 )