結果
問題 |
No.2226 Hello, Forgotten World!
|
ユーザー |
|
提出日時 | 2024-12-21 11:05:32 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 206 ms / 2,000 ms |
コード長 | 671 bytes |
コンパイル時間 | 406 ms |
コンパイル使用メモリ | 81,852 KB |
実行使用メモリ | 77,148 KB |
最終ジャッジ日時 | 2024-12-21 11:05:34 |
合計ジャッジ時間 | 1,983 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
T = int(input()) def dist(i): a = S[i:i+10] b = "helloworld" cnt = 0 for k in range(10): if a[k]=="?" or a[k]==b[k]: continue cnt += 1 return cnt for _ in range(T): N = int(input()) S = list(input()) A = [] for i in range(N-10,-1,-1): d = dist(i) if d==0: A.append(i) if len(A)==0: print(-1) else: B = [] for i in A: T = S[:] T[i:i+10] = list("helloworld") for j in range(N): if T[j]=="?": T[j] = "a" B.append("".join(T)) B = sorted(B) print(B[0])