結果

問題 No.2226 Hello, Forgotten World!
コンテスト
ユーザー 👑 AngrySadEight
提出日時 2022-12-09 00:40:03
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 327 ms / 2,000 ms
コード長 793 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 248 ms
コンパイル使用メモリ 85,500 KB
実行使用メモリ 81,020 KB
最終ジャッジ日時 2026-03-11 01:33:37
合計ジャッジ時間 1,948 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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