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

Hint
Posted by Ibragim Atadjanov (Tashkent U of IT) 17 Oct 2010 13:45
This problem seems hard but the algo is so simple.
if there n pedestals then the m is always 2 * n - 1;

if you just at i-pedestal and original is at jth, then
1. if abs(i - j) - even you can catch it if you just walk towards it just by one.
2. if abs(i - j) - odd then you just two times take the i-th pedestal to make the difference even and go to 1.

For doing above algo just start from the 1st pedestal to n
and take n again then go back to the 2nd pedestal

Good luck



Edited by author 17.10.2010 13:47
Re: Hint
Posted by Mohan 25 Sep 2014 12:58
You say m is always 2 * (n-1) or is it (2*n) - 1
whichever it is, your initial logic doesn't even satisfy the given output for n = 3.
By your above method m should either be 2 * (3-1) = 4 or (2*3) - 1 = 7 whichever formula you intended to say - none of them satisfy the given output i.e. for n = 3 , m = 2