結果
| 問題 | No.2768 Password Crack |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-31 22:03:41 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 629 bytes |
| 記録 | |
| コンパイル時間 | 137 ms |
| コンパイル使用メモリ | 85,424 KB |
| 実行使用メモリ | 101,856 KB |
| 平均クエリ数 | 134.03 |
| 最終ジャッジ日時 | 2026-05-27 18:42:55 |
| 合計ジャッジ時間 | 4,932 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 3 RE * 2 TLE * 1 -- * 23 |
ソースコード
N=int(input())
def get_password(ans):
ret=[]
for c in ans:
ret.append(chr(c+ord("a")))
return "".join(ret)
ans=[0 for _ in range(N)]
i=0
password=get_password(ans)
print(f"? {password}")
match=int(input())
while 1:
if match==N:
exit(print(f"! {password}"))
# matchが減るなら一つ前が正解。変わらないなら繰り返す。増えたらそれが正解。
while ans[i]<25:
pre=match
ans[i]+=1
password=get_password(ans)
print(f"? {password}")
match=int(input())
if match>pre:i+=1;break
elif match<pre:ans[i]-=1;i+=1;break