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

Discussion of Problem 1298. Knight

Posted by [OSTU]Svetkin 7 Apr 2004 01:18
Recursive algorithm seems to slow for n=8. Actually, it depends on the order of moves, but the order fast for n=8 was slow for 6 or 7, the fast one for 7 was slow for 8 and so on... Anyway, I used pregenerated output to solve this.
Is there a way to optimize the algorithm?
Re: recursion?
Posted by sloboz 7 Apr 2004 03:47
there is a greedy solution but non-demonstrable: you start from some position and then you go to the position that has the fewest future possible moves...
here are the solutions that I've computed with this:
for n = 5, 6, 7 and 8;
N = 5:

N = 6:

N = 7:

N = 8:
Re: recursion?
Posted by marius dumitran 9 Apr 2004 18:41
i used back and got AC in 0.46 ....
Posted by Vlad Veselov 10 Apr 2004 15:48
I wonder: my recursive solution for n=8 works faster than for n=7.
No subject
Posted by test_programs 9 May 2004 19:10
you may be not use recursion.
you may draw on sheet this and type answer to program...
Re: recursion?
Posted by TheBeet 26 Jun 2004 10:15
I got AC in 0.031s .
But I not just submit the answer.
I just use DFS.

Edited by author 26.06.2004 10:16
My prog runs realy fast
Posted by Amberchild 23 Mar 2005 16:26
I do it in 0.015 sec
I don`t use CONSTANT solv
Re: recursion?
Posted by Allanur 1 Apr 2014 17:32
I am also use DFS and AC in 0.718s.
Why my program slowly from you?
Re: recursion?
Posted by Bekmyrat 1 Apr 2014 18:16
What is your fu*king dfs solutions? how did u manage that it is impossible!
My answer accepted in 0.734 sec
I also used DFS

Edited by author 01.04.2014 18:17