Can somebody explain output of the test case 5? How can it be “NOT MOVING”? I am stuck at this test case.
https://www.codingame.com/training/medium/locked-in-gear
Did you try drawing it?
I got also stuck. But after drawing I figured out that my problem was that I stopped my BFS when finding the last one in the initial inputs which was wrong because you need to check if something breaks further down the line.
3
0 0 3
0 4 1
3 4 2
This test case says “NOT MOVING”
But all the gear touches
Draw this test case and you will see why the gears do not move (or try it with LEGO gears).
Hi!
My solution for the puzzle “Locked In Gear” passes all tests and 6/7 validators after submitting.
The validator that fails is “Jammed”, but I can’t wrap my head around why.
Anyone that had this validator fail has any idea of what it could be?
Thanks!
If you used float-point numbers in calculation, check the accuracy
0.99999999… means 1
Thank you, but while I was indeed not comparing values correctly (double <= int), and changed to " abs(double - int) <= 0.0001, the result is still the same. Everything passes except the validator < Jammed >
Hi Berton. A bit late, but the reason is that two gears are affecting the last (third) gear. And they try to turn the last gear in opposite directions, hence there is no movement. If you draw it on paper and try to imagine what happens when the first gear moves, you should see it