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 1789. Searching for the Dodecahedron

The real solution
Posted by Huang Da 27 Aug 2011 11:46
Don't know why so many authors have posted 2*n-1.. That's obviously a wrong solution...

Just think about if the stone is in the odd and the man touches the odd, things will be done smoothly.
Re: The real solution
Posted by Solver 24 Jul 2026 12:03
The real solution is writing a "checker" for this problem, and then BFS over possible states from 2^n-1 to reach 0 (on bitmask of where it can be located). That produces a nice pattern which is always 2*(n-2), and ofc. shortest possible since it's fair BFS.
2 3 ... n-2 n-1 2 3 .... n-2 n-1 for odd N
2 3 ... n-2 n-1 n-1 n-2 ... 3 2 for even N