Back to General discussions forum
Thanks for an amusing New Year problem. After testing it 5 times it seems to be working well.
Happy New Year!
Dear Clive, thank you for such a quick proof-solving!
Initially there was idea of asking to find fastest route along the track - I thought this is typical DP somewhat ressembling your "Train Merge" puzzle - but got a bit confused with situation where car can return to any given point. So decided to request this "divide by 3" limitation on moves (picked upon manual experiments). So I was unsure.
All the best wishes to you and everyone in a New Year!
Rodion,
I have been experimenting with your original idea, using the road data sets that you have created. Finding a solution which uses the smallest number of moves takes about 7 seconds using my python program. However, this solution allows for backwards movement. Perhaps not surprisingly, the minimum number of moves appears to be the same whether or not we allow backwards movement; although I cannot guarantee that this will always be the case. If backwards movement is not allowed my python program finds the minimum number of moves in less than one second.
I think this would make a good additional problem. You can simply require all movement to be forwards. The solution should give the minimum number of moves, followed by a valid move sequence. If the move sequence is not required then it becomes too easy to pass the problem by guessing the minimum number of moves.
Thanks for a fun new problem, Rodion!
FWIW, my "quickest possible run" Python solution runs in 172ms.
Happy New Year, everyone!