Re: Riddle Me This.. [UPDATED]
100 people find themselves at the gates of ATA headquarters. Kenshi Arasaki tells them that they'll have a chance to go to heaven instead, but first they'll have to play a game.
Kenshi Arasaki is going to line them all up in a straight queue, each person facing the back of the next person in line. The order of people in this line will be randomly chosen when the game starts.
Eric Diep is going to put a red or blue hat on each person. Each hat can be red or blue at random. Nobody knows the color their hat will be before the game starts.
Each person will be able to see the hat of everyone in front of them, but won't be able to see the hats of anyone behind them. Everyone can hear everyone else.
Kenshi Arasaki will then then ask each person the color of their hat, starting at the back of the line and moving forward. Each person must just say "red" or "blue", without any extra intonation.
People cannot communicate at all beyond merely saying the word "red" or "blue". If a person correctly says the color of their own hat, then they will be sent to heaven -- if they get the color wrong they stay in ATA headquarters, and will rot in the Halls of Support for all of eternity, answering email after email after email after email....
Before the game starts, the people are allowed to come up with a strategy to save as many people as possible.
OmegaLSA proposes that every other person says the color of the hat of the person in front of them, and then the people in between repeat that color to save themselves. "That will save a guaranteed 50 people, and will probably save around 75," he says.
"No," Bellemorte says. "I've got a plan that is guaranteed to save 99 of us, maybe all of us."
What is Bellemorte's plan?
ANSWER:
Bellemorte came up with the following strategy:
The first person to answer (the last person in line) will count the number of red hats in front of him. If there's a even number, he'll say "red", otherwise, he'll say "blue." This first answerer is not guaranteed to be saved, but has a 50% chance.
The next person in line can then count the number of red hats in front of him. If he sees an even number, then his own hat must be blue (since the last person also saw an even number). If he sees an odd number, his hat must be red. So he then says his own hat color.
Now the NEXT person in line counts the number of red hats in front of him. Given whether the first person saw an even or odd number of red hats, combined with the knowledge of the second person's hat being red or blue, he can figure out if there should be an even or odd number of hats among himself and all of the people in front of him. Based on his count of the number of red hats in front of him, he can then figure out if his own hat is red or blue.
This follows the same structure all the way to the front of the line: based on the odd or even count of all the hats excluding the first answerer, combined with the answers of all the people before, each person can then count the number of red hats in front of them and figure out what color their own hat is.