結果

問題 No.2226 Hello, Forgotten World!
ユーザー ニックネームニックネーム
提出日時 2023-02-25 00:02:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 548 bytes
コンパイル時間 109 ms
コンパイル使用メモリ 10,904 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2023-10-11 07:05:43
合計ジャッジ時間 1,022 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,964 KB
testcase_01 AC 17 ms
7,860 KB
testcase_02 AC 36 ms
7,900 KB
testcase_03 WA -
testcase_04 AC 17 ms
7,804 KB
testcase_05 AC 17 ms
7,768 KB
testcase_06 AC 17 ms
7,920 KB
testcase_07 WA -
testcase_08 AC 17 ms
7,844 KB
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
    n = int(input())
    s = input()
    t = "helloworld"
    if t in s: print(s); continue
    for i in range(n-10,-1,-1):
        if s[i-9:i+1]==t[:9]+"?": ans = s[:i-9]+t+s[i+1:]; break
        f = s[i-1:i]=="h"
        for j in range(9):
            if "?"!=s[i+j]!=t[j+1]: f = False
        if f: ans = s[:i-1]+t+s[i+9:]; break
        f = True
        for j in range(10):
            if "?"!=s[i+j]!=t[j]: f = False
        if f: ans = s[:i]+t+s[i+10:]; break
    else: ans = "-1"
    print(ans.replace("?","a"))
0