atcoder#AGC044D. [AGC044D] Guess the Password
[AGC044D] Guess the Password
Score : points
Problem Statement
This is an interactive task.
You have to guess a secret password . A password is a nonempty string whose length is at most . The characters of a password can be lowercase and uppercase english letters (a, b, ... , z, A, B, ... , Z) and digits (0, 1, ... , 9).
In order to guess the secret password you can ask queries. A query is made of a valid password , the answer to such query is the edit distance between and (the operations considered for the edit distance are: removal, insertion, substitution). You can ask at most queries.
Note: For a definition of edit distance (with operations: removal, insertion, substitution), see this wikipedia page
.
Constraints
- The secret password is chosen before the beginning of the interaction.
Interaction
To ask a query, print on Standard Output (with a newline at the end)
? T
The string must be a valid password.
The answer to each query shall be read from Standard Input in the form:
ans
As soon as you have determined the hidden password , you should print on Standard Output (with a newline at the end)
! S
and terminate your program.
Judgement
- After each output, you must flush Standard Output. Otherwise you may get
TLE
. - After you print (your guess of) the hidden password, the program must be terminated immediately. Otherwise, the behavior of the judge is undefined.
- If the password you have determined is wrong, you will get
WA
. - If you ask a malformed query (for example because the string is not a valid password, or you forget to put
?
) or if your program crashes or if you ask more than queries, the behavior of the judge is undefined (it does not necessarily giveWA
).
Samples
In the only sample testcase of this problem the hidden password is Atcod3rIsGreat
.
The following one is an example of interaction if Atcod3rIsGreat
.
Input | Output |
---|---|