結果

問題 No.2226 Hello, Forgotten World!
ユーザー AngrySadEightAngrySadEight
提出日時 2022-12-09 00:40:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 499 ms / 2,000 ms
コード長 793 bytes
コンパイル時間 424 ms
コンパイル使用メモリ 86,968 KB
実行使用メモリ 77,464 KB
最終ジャッジ日時 2023-09-07 02:39:11
合計ジャッジ時間 2,784 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,156 KB
testcase_01 AC 499 ms
77,464 KB
testcase_02 AC 181 ms
77,388 KB
testcase_03 AC 166 ms
77,248 KB
testcase_04 AC 105 ms
77,432 KB
testcase_05 AC 172 ms
77,096 KB
testcase_06 AC 125 ms
77,164 KB
testcase_07 AC 133 ms
77,160 KB
testcase_08 AC 105 ms
77,112 KB
testcase_09 AC 139 ms
77,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
for _ in range(T):
    N = int(input())
    S = str(input())
    
    ans = ''
    hello = 'helloworld'
    pos = False
    for i in range(N):
        ans += 'z'
    for i in range(N - 9):
        possub = True
        anssub = ''
        for j in range(10):
            if S[i + j] != '?' and S[i + j] != hello[j]:
                possub = False
        if possub:
            pos = True
            for j in range(N):
                if 0 <= j - i < 10:
                    anssub += hello[j - i]
                else:
                    if S[j] == '?':
                        anssub += 'a'
                    else:
                        anssub += S[j]
            if ans > anssub:
                ans = anssub
    if pos:
        print(ans)
    else:
        print(-1)
0