Which blocks of $5×5$ grid can have the last lit lamp?

77 Views Asked by At

There is one off lamp in each block of a $5×5$ grid. Each round we can choose a block and change the status of the lamp inside it. As a result, lamps in the neighboring blocks (sharing a common side) also change their status i.e., from on to off or from off to on. If there is only one turned on lamp at the end, which blocks can possibly contain it?

I can guess that it must be on the sides because if we change the status of one of the lamps in the middle and all the neighboring lamps to on, there will be no way of changing all the neighboring stats back to off without changing the value of the one in the middle. Or at least I couldn't find one.

1

There are 1 best solutions below

0
On BEST ANSWER

I don't know how to show a grid here so I'm gonna show the grid in forms of stars and dashes. If we color our grid like this:

* _ * _ *
* _ * _ *
_ _ _ _ _
* _ * _ *
* _ * _ *

Any block and it's neighboring blocks can cover an even amount of the starred blocks. Now let's reverse our problem. Assume that we have a lit lamp in one of the blocks and we are trying to turn all lights off. If the lit lamp is in one of the starred blocks, we cannot reach that state. Because the number of lit lamps in starred blocks always remains odd. That is because as i said each block and it's neighboring blocks can cover an even amount of the starred blocks. So if the chosen blocks contain the lit lamp, Even - 1 change state to on and one lamp to off.( still an odd amount of lit lamps in starred blocks ) and if it's not contained, all the lights will go on and then we will have even + 1 lights on which would still be an odd number. Same logic can be applied in each step proving that we can never reach an state of all lights off because then the number of lit lamps it the starred area wouldn't be odd. So the lit lamp cannot be placed in the starred blocks We can also rotate the grid 90 degrees and the use the same logic on the new starred blocks. Back to our own problem So if we want to reach a one lit lamp state from all off lamp state the last lit lamp can only be in blocks (2,2) , (2,4) , (3,3) , (4,2) , (4,4) ( row , col )