Hide

Problem F
Hotter or Colder

Languages en sv

You and Theo-dÅre Busskow are on a bus heading to KTH’s computer science section’s annual trip to Åre, dÅre.
The bus ride takes a long time, so you’ve decided to play "Hotter or Colder." Here’s how a round of the game works:

  • TheodÅre thinks of a word and gives you a starting word so that you have something to work from.

  • You guess a word.

  • TheodÅre responds with either "colder" or "hotter," first based on your previous guess, then based on your best guess so far.

A word is "hotter" if TheodÅre considers its semantic meaning closer to the target word, and "colder" if it is considered more distant.
Of course you’re not quite sure what words TheodÅre associates with what, so the only thing you can go off of is that you know he is an avid reader of news and books, as well as your own intuition of what words should be closer to each other.

You continue playing until you either guess the correct word or fail so badly that you might as well have guessed every word in TheodÅre’s vocabulary (10,001 words) in fewer attempts. In that case, he gets bored and wants to move on to a new word. (The entire vocabulary is available in vocabulary.txt under "attachments" on Kattis.)
This means you have 10,001 attempts before moving to the next round, and it is counted as if you guessed correctly in 10,001 attempts.

However, one round is usually not enough for the entire trip, so TheodÅre has decided that you will play $N$ rounds of the game.

For this task we have not given you training data, this means that you are free to find whatever training data you may want on the internet.

Input

First, a single integer $N$ appears on a line. Then, the following sequence repeats $N$ times until the game ends:
A string $S$, the word you start with.
For each guess you make, the response is one of the following:

  1. A string "YES" or "NO." "YES" means you guessed the correct word, while "NO" means TheodÅre doesn’t want to continue this round. After "YES"/"NO," the next round begins unless it was the last one.

  2. Two strings: $S1, S2$. These strings are always either "hotter" or "colder." $S1$ indicates whether your guess is "hotter" or "colder" than the previous word, while $S2$ indicates whether your guess is "hotter" or "colder" than your best guess so far.

Output

After each line TheodÅre sends, you should respond with a string, your guess, unless the round is over.
Make sure to flush the output after every print, otherwise, you may get Time Limit Exceeded. In C++, this can be done with cout << flush; or fflush(stdout);, in Python, it happens automatically when using input(), but otherwise, you need to use sys.stdout.flush(), and in Java, with System.out.flush();.

Scoring

Your solution will be tested on a set of test groups. The score for a given test case is calculated using the following formula:

\[ Score = min(100, 100\cdot (\frac{10001-totscore}{10000})^{13}) \]

where "totscore" is the number of guesses it took you to reach the correct answer in a given round.
The score you receive for a test case will be the average Score across the tested rounds. During the competition, scoring is based on $30\% $ of the rounds per test case. At the end of the competition, we switch to the remaining $70\% $. This means the score displayed on the scoreboard during the competition may not be the final score.
The score you receive per group is the average of all test case scores in that group.

Group

Points

Constraints

$1$

$30$

$N \leq 10$

$2$

$40$

$N \leq 100$

$3$

$30$

$N \leq 1000$

Read Sample Interaction 1 Write
1
utmaningar
bönder
hotter hotter
matematik
colder colder
svenskar
hotter colder
göteborgare
YES

Please log in to submit a solution to this problem

Log in