# Sebia Team Selection Test Problem 1

We have $$2015$$ prisoners.The king gives everyone a hat coloured in one of $$5$$ colors. Everyone sees all hats expect his own. Now, the King orders them to stand in a line(a prisoner can see everyone behind and in front of him). The king asks the prisoners one by one whether he knows the color of his hat. If he answers NO, then he is killed.If he answers YES, then answers which color his hat is correctly, he goes to freedom, if he answers incorrectly, he is killed. All the prisoners can hear his answer (YES or NO),but if he answered YES, they don't know what he answered. However, they do see him get killed if he answers incorrectly. They can think of a strategy before the King comes,but after that they can't comunicate. If they play optimally, what is the maximum amount of prisoners we can guarantee can survive?

×