AtCoder Grand Contest 044
D
Guess the Password
AtCoder
⌀ 3165
原题
← CE →
翻译中…

Problem Statement

翻译中…

This is an interactive task.

翻译中…

You have to guess a secret password $S$. A password is a nonempty string whose length is at most $L$. 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 $S$ you can ask queries. A query is made of a valid password $T$, the answer to such query is the edit distance between $S$ and $T$ (the operations considered for the edit distance are: removal, insertion, substitution). You can ask at most $Q$ queries.

翻译中…

Note: For a definition of edit distance (with operations: removal, insertion, substitution), see this wikipedia page.

翻译中…

Constraints

翻译中…
  • $L = 128$
  • $Q = 850$
  • The secret password $S$ 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 $T$ must be a valid password.

翻译中…

The answer $ans$ to each query shall be read from Standard Input in the form:

翻译中…

ans

翻译中…

As soon as you have determined the hidden password $S$, 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 $Q$ queries, the behavior of the judge is undefined (it does not necessarily give WA).
翻译中…

Samples

翻译中…

In the only sample testcase of this problem the hidden password is Atcod3rIsGreat.

翻译中…

The following one is an example of interaction if $S=$Atcod3rIsGreat.

翻译中…
Input Output
$\texttt{? AtcoderIsBad}$
$5$
$\texttt{? AtcoderIsGreat}$
$1$
$\texttt{! Atcod3rIsGreat}$
翻译中…
题目信息
题号
agc044_d
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。