vortihacker.blogg.se

A hat in time 2
A hat in time 2








a hat in time 2

Thus, the string 101 should be printed as the answer. More specifically, player 2 can deny neither the possibility that S= RRB nor the possibility that S= RBR with just the information he has, so he cannot determine the color of his hat. Player 1: answers Yes to your question.Īfter all rounds, players 1 and 3 know the colors of their hats.You announce, "Players 1 and 3 answered Yes.".Player 3: answers Yes to your question.Thus, he realizes his hat is red, and answers Yes to your question. Then, player 2 should have noticed in round 1 that his hat is red. Player 3: Because the hats of the players in front of him are red and blue, he realizes his hat is red.First, you announce to all players, "Two players wear red hats, and one wears a blue hat.".In the first case, the game goes as follows. Process T test cases for each input file.

a hat in time 2

They start answering Yes in the first round when the color of their hat is determined.Īdditionally, they know that the other players also take this strategy, and use this knowledge to infer the color of their hat.įor each player, find whether they will have found out the color of their own hat after all rounds. Note that you just announce the player numbers and not the colors of their hats.Īll players are extremely clever and know that the other players are also clever. After asking all players, you announce all players who have answered Yes.You ask each player, "Have you found out the color of your own hat?"Įach player will honestly answer Yes or No without being heard by other players.Then, you repeat the following sequence of events (called a round) 10^ times. Particularly, they cannot see the color of their own hat.įirst, you count the numbers of players with red hats and those with blue hats, and tell them to all players. You know the string S, but the players do not.Įach player can only see the colors of hats of the players in front of them (namely, the players with smaller player numbers). The colors of the hats are represented by a string S: player i wears a red hat if the i-th character of S is R, and a blue hat if it is B. The players line up behind one another, numbered 1 to N from front to back. You, the game master, and N players play a Hat Guessing Game.










A hat in time 2