結果

問題 No.2226 Hello, Forgotten World!
ユーザー kohakoha11301kohakoha11301
提出日時 2023-03-01 11:19:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 232 ms / 2,000 ms
コード長 597 bytes
コンパイル時間 1,380 ms
コンパイル使用メモリ 86,748 KB
実行使用メモリ 83,624 KB
最終ジャッジ日時 2023-10-14 16:07:33
合計ジャッジ時間 2,861 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
71,536 KB
testcase_01 AC 232 ms
83,624 KB
testcase_02 AC 129 ms
77,736 KB
testcase_03 AC 123 ms
77,532 KB
testcase_04 AC 104 ms
77,252 KB
testcase_05 AC 123 ms
77,580 KB
testcase_06 AC 114 ms
77,412 KB
testcase_07 AC 117 ms
77,288 KB
testcase_08 AC 105 ms
77,112 KB
testcase_09 AC 119 ms
77,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import copy
h = 'helloworld'
for _ in range(int(input())):
    n = int(input())
    s = list(input())
    ans = []
    for i in range(len(s) - len(h), -1, -1):
        flag = True
        for j in range(len(h)):
            if s[i + j] == '?' or s[i + j] == h[j]:
                continue
            else:
                flag = False
        if flag:
            t = copy.copy(s)
            for j in range(len(h)):
                t[i + j] = h[j]
            ans.append(''.join(t).replace('?', 'a'))
    ans.sort()
    # print(ans)
    if ans:
        print(ans[0])
    else:
        print(-1)
0