結果
問題 | No.2768 Password Crack |
ユーザー |
|
提出日時 | 2024-05-31 22:53:29 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 129 ms / 2,000 ms |
コード長 | 655 bytes |
コンパイル時間 | 276 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 27,736 KB |
平均クエリ数 | 776.37 |
最終ジャッジ日時 | 2024-12-21 00:56:51 |
合計ジャッジ時間 | 5,291 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 29 |
ソースコード
n = int(input()) N = [] S = "" for i in range(n): for j in range(ord('a'), ord('z')): c = chr(j) print("? " + S + c + 'z' * (n+~i)) N.append(int(input())) if N[-1] == n: print("! " + S + c + 'z' * (n+~i)) exit() if len(N) <= 1: continue elif len(N) == 2 and N[1] < N[0]: S += 'a' N[1] = N[0] break elif c == 'a' and N[-1] < N[-2]: S += 'z' N[-1] = N[-2] break elif N[-1] > N[-2]: S += c break else: S += 'z' N[-1] += 1 print("! " + S)