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 Bekzhan 23 Nov 2012 23:12
Backtracking works on this problem) I wrote code, using it, and i thought it'll got TL. But when I tried, it get AC) (Sorry for my poor english)
Re: Hint
Posted by ER 5 May 2014 11:39
The running time of a simple backtracking search will depend on the move search order you use.

For example, this order:

moves = [ a, e, f, b, c, g, h, d ]
  where a = (1,-2)
        b = (1,2)
        c = (-1,2)
        d = (-1,-2)
        e = (2,1)
        f = (2,-1)
        g = (-2,1)
        h = (-2,-1)

works great for n = 7, but not 6 or 8.