No.2768 Password Crack
レベル :
/ AI推定難易度 : 800
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / リアクティブ問題 (詳しくはこちら)
タグ : / 解いたユーザー数 106
作問者 :
srjywrdnprkt
/ テスター :
👑
p-adic
タグ : / 解いたユーザー数 106
作問者 :
srjywrdnprkt
/ テスター :
👑
問題文最終更新日: 2024-05-30 17:43:50
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 431
(順位表)
の他の問題:
Problem Statement
This is an interactive problem.
$S$ is a string of length $N$ consisting only of lowercase English letters. $S$ is not given directly.
Instead, you may ask the judge system the following question up to $2500$ times.
Find the string $S$.
Constraints
Input and Output
This is an interactive problem (a problem in which the program you write and the judge program interact through input and output).First, the length $N$ of the string $S$ is given in the following format.
$N$Repeat your questions until you can determine the string $S$. Print each question to standard output in the following format.
$?$ $T$The response to it is given from standard input in the following format.
$n$Here, $n$ is the number of positions at which $S$ and $T$ match. Once you have determined the string $S$, print it to standard output in the following format.
$!$ $S$
Notes
Sample
The following is an example of an interaction that starts with $S=$
pswd.
| Input | Output | Explanation |
|---|---|---|
4 |
The length of $S$, which is $4$, is given. | |
? abcd |
Ask for the number of positions at which $S$ and $T=$abcd match. |
|
1 |
$S$ and $T$ match at only $1$ position, the $4$-th character, so $1$ is returned. | |
? hoge |
Ask for the number of positions at which $S$ and $T=$hoge match. |
|
0 |
There are no positions at which $S$ and $T$ match, so $0$ is returned. | |
? pswd |
Ask for the number of positions at which $S$ and $T=$pswd match. |
|
4 |
$S$ and $T$ match at $4$ positions, the $1,2,3,4$-th characters, so $4$ is returned. | |
! pswd |
We now know that $S=$pswd, so print this. |
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。