結果
| 問題 | 
                            No.2768 Password Crack
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2024-06-01 20:37:45 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 252 ms / 2,000 ms | 
| コード長 | 459 bytes | 
| コンパイル時間 | 423 ms | 
| コンパイル使用メモリ | 82,412 KB | 
| 実行使用メモリ | 94,680 KB | 
| 平均クエリ数 | 1785.17 | 
| 最終ジャッジ日時 | 2024-12-22 09:58:25 | 
| 合計ジャッジ時間 | 8,256 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 29 | 
ソースコード
from collections import defaultdict
N = int(input())
ans = ['z'] * N
T = ['z'] * N
rem = 2500
for i in range(N):
    cnt = defaultdict(list)
    for d in range(25):
        T[i] = chr(ord('a') + d)
        print(f"? {''.join(T)}", flush=True)
        n = int(input())
        cnt[n].append(T[i])
        rem -= 1
    if len(cnt) == 1:
        continue
    key = max(cnt.keys())
    ans[i] = cnt[key][0]
assert rem >= 0
print(f"! {''.join(ans)}", flush=True)