BrainDen.com - Brain Teasers
• 0

# Red and Blue hats -- All or Nothing

Go to solution Solved by Izzy,

## Question

In a long hallway, 100 prisoners are given red or blue hats, whose color only the other prisoners can see.  At a signal given by the warden the prisoners must walk single file through a door and take their places inside a large room. The room is circular and its wall, ceiling and floor are featureless. Nothing is said, nor are any gestures made to prisoners as they enter the room and take their place. When the last prisoner has taken his place the warden inspects the configuration of their hat colors. If the colors form two monotonic groups separable, say, by some straight line, then all the prisoners are freed. If their hat colors instead are intermingled, they are all executed.

Prisoners are allowed to discuss strategy before receiving their hats. What is their fate?

Let's see, what else? Oh ya, they can't just pass their hats around. They're super-glued on their heads. Ouch. And no one has a magic marker to ... uh ... you know, make a line ... or anything like that.

## Recommended Posts

• 1
• Solution

First prisoner walks in the room. Second prisoner stands to the right him (unless they're not allowed to move again? Then, he stands  to the right still, but not too close.) The third prison can then see the colors of the hats of the first two prisoners. If the hats are different colors, the third prisoner stands between the first two prisoners. If the hats are the same color, the third prisoner stands to the right of the second prisoner. So, now the fourth prisoner does the same thing. If the hats are all the same color, he stands to the outside. If the hats are different colors, he stands between the two people who have opposite colored hats that are standing next to each other. Continue in this fashion. This sorts the prisoners into a long line, where all the red hats are together and all the blue hats are together. The monotonic groups are separated by the line between the only two people standing next to each other with opposite colored hats (unless all hats were the same color to begin with.) So, basically this line is between the last person and the 99th person, assuming at least one hat of each color.

Example, in case I explained that poorly. Numbers indicate the entrance of the prisoners

1; 1 2; 1 2 3; 1 2 4 31 2  5 4 3 etc.

Edited by Izzy
Did not save multiple colors.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.