結果

問題 No.2226 Hello, Forgotten World!
ユーザー nephrologistnephrologist
提出日時 2023-02-25 18:34:26
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 837 bytes
コンパイル時間 327 ms
コンパイル使用メモリ 86,780 KB
実行使用メモリ 119,220 KB
最終ジャッジ日時 2023-10-11 15:32:57
合計ジャッジ時間 4,007 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
75,152 KB
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

input = sys.stdin.readline
hoge = list("helloworld")
t = int(input())
for _ in range(t):
    n = int(input())
    s = list(input().rstrip())
    for i in range(n):
        if s[i] == "?":
            s[i] = "`"
    ans = -1
    kouho = []
    for start in range(n - 9):
        okflag = 1
        for i in range(10):
            if s[start + i] == hoge[i] or s[start + i] == "`":
                continue
            else:
                okflag = 0
                break
        if okflag:
            temp = s[:]
            for i in range(10):
                temp[i + start] = hoge[i]
                kouho.append(temp)
    if not kouho:
        print(ans)
        continue
    kouho.sort()
    ans = kouho[0]
    for i in range(n):
        if ans[i] == "`":
            ans[i] = "a"
    print("".join(ans))
    # exit()
0