|
Asuna |
My turn! This place is super fun, too! |
|
Asuna |
What’s it gonna be~? I’m getting excited! |
“Welcome! I am the <Lounge Guide>, here to show you around the play lounge! My job is to explain how to use our facilities and the rules to our guests. You are aware that all services aboard the Golden Fleece are exchanged for currency earned through games, correct? Everything on this ship... lodging, meals, entertainment facilities, even the restrooms, has its service quality determined by the amount of currency you have earned through games. Ranks range from D to S depending on your wealth. Generally, reaching A lets you enjoy all the finest services aboard! S rank is truly the stuff of dreams!”
|
Asuna |
Ahahaha! What is this? It’s so much fun! |
|
Karin |
(With Asuna’s luck, she will surely win a prize in no time.) |
|
|
The first line contains the number of game machines .
Each of the next lines contains two positive integers and a character representing the operator.
Print lines, each containing the minimum number of rounds after which Asuna can correctly identify without arousing suspicion.
The first game machine
Entering in the first round displays No.
There is no way to determine the operator with fewer than input.
Akane
|
(That does sound like Asuna. Let us try as well. You too, Captain.) |
|
Neru |
(H-huh? Fine, I’ll do it! Tch.) |
Players can play games against the game machines!
Each machine is configured with a positive integer of at least , a positive integer not exceeding , and a character representing an operator. The operator is either or !
Each machine reveals , but not or the operator . A player may enter an integer from to , inclusive. Each time the player enters an integer, the machine displays Yes or No according to the following internal procedure.
Let be the value stored inside the machine. Initially, .
In each round, the player may enter an integer.
Let the entered integer be , which must be between and , inclusive.
If applying operator to the stored value and the entered integer produces a value at most , the machine displays Yes; otherwise, it displays No. In other words, letting :
The player's goal is to identify operator ; there is no need to determine . Once the player identifies , fewer rounds mean more currency earned.
While wandering around the ship, Asuna happened to pick up a note listing information about every game machine. The note specifies the and configured for each machine.
Asuna thinks that guessing immediately might arouse the casino's suspicion and get her thrown out, so she wants to play the minimum number of rounds needed to avoid suspicion.
The integers Asuna has entered so far, together with the Yes/No response to each, form a transcript. Consider whether there is a pair that could produce exactly the same Yes/No responses for those inputs.
Thus, as soon as only one operator remains possible, she can give the correct answer without arousing suspicion. Given a machine configured with , , and , find the minimum number of rounds after which Asuna can answer correctly without arousing suspicion.
The character in the input represents .
The second game machine
Entering in the first round displays Yes.
Entering in the second round displays Yes.
Entering in the third round displays Yes.
There is no way to determine with fewer than inputs.
The updated value of is used in the next round.
Note that is updated only when Yes is displayed.
The player may play as many rounds as desired.