Q:
The warden meets with 23 new prisoners when they arrive. He tells them, "You may meet today and plan a strategy. But after today, you will be in isolated cells and will have no communication with one another.
"In the prison is a switch room, which contains two light switches labeled A and B, each of which can be in either the 'on' or the 'off' position. I am not telling you their present positions. The switches are not connected to anything.
"After today, from time to time whenever I feel so inclined, I will select one prisoner at random and escort him to the switch room. This prisoner will select one of the two switches and reverse its position. He must move one, but only one of the switches. He can't move both but he can't move none either. Then he'll be led back to his cell.
"No one else will enter the switch room until I lead the next prisoner there, and he'll be instructed to do the same thing. I'm going to choose prisoners at random. I may choose the same guy three times in a row, or I may jump around and come back.
"But, given enough time, everyone will eventually visit the switch room as many times as everyone else. At any time anyone of you may declare to me, 'We have all visited the switch room.' and be 100% sure.
"If it is true, then you will all be set free. If it is false, and somebody has not yet visited the switch room, you will be fed to the alligators."
What is the strategy they come up with so that they can be free?
A: Here is one that will work, though it might take long time:
Pick a person as switch A monitor. For this person, whenever he sees switch A off, put it back to on, and count it once; if the switch A is on, move the switch B.
For all other prisoners, for their first two times seeing switch A on, move the switch A to off, otherwise, move only the switch B.
Since there are 22 other prisoners, total switching from on to off of switch A will be 44 times, so the monitor will be able to count at least 44. The first count might not indicate a true visit of other prisoner since the initial status of switch A is unknown (If the initial status of switch A is off, the monitor will count it once when he visit the room)
The monitor will finally count either 44 or 45 times, and he can declare that every prisoner has visited the switch room at the 44th time, because if only 21 visited, he can count at most 43.
Note: the rule for other prisoners can not be switching A from on to off only once, as the monitor might finally count either 22 or 23. At time 22, he can not be sure about whether all other 22 has been to the room. And he might never be able to count to 23.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment