結果

問題 No.2226 Hello, Forgotten World!
ユーザー norikame
提出日時 2022-12-14 02:41:41
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 517 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-06-24 21:22:21
合計ジャッジ時間 1,037 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

# 

TAR = 'helloworld'
TLEN = len(TAR)

t0 = int(input())
for i0 in range(t0):
    n = int(input())
    s = input()
    res = ''
    for i in range(n-TLEN+1):
        ok = True
        for j in range(TLEN):
            if s[i+j]!='?' and s[i+j]!=TAR[j]:
                ok = False
                break
        if not ok:
            continue
        ts = (s[:i] + TAR + s[i+TLEN:]).replace('?', 'a')
        if not res or ts < res:
            res = ts
    if not res:
        print(-1)
    else:
        print(res)
0