Understanding test case for locked-in-gear puzzle


#1

Can somebody explain output of the test case 5? How can it be “NOT MOVING”? I am stuck at this test case.


#2

Did you try drawing it?


#3

gears

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.


#4

3
0 0 3
0 4 1
3 4 2

This test case says “NOT MOVING”

But all the gear touches


#5

Draw this test case and you will see why the gears do not move (or try it with LEGO gears).