結果

問題 No.2226 Hello, Forgotten World!
ユーザー lllllll88938494lllllll88938494
提出日時 2023-03-22 05:38:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 357 ms / 2,000 ms
コード長 834 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 81,716 KB
実行使用メモリ 132,852 KB
最終ジャッジ日時 2023-10-18 18:48:16
合計ジャッジ時間 1,938 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,540 KB
testcase_01 AC 357 ms
132,852 KB
testcase_02 AC 124 ms
84,156 KB
testcase_03 AC 125 ms
85,408 KB
testcase_04 AC 75 ms
78,132 KB
testcase_05 AC 125 ms
85,744 KB
testcase_06 AC 87 ms
79,136 KB
testcase_07 AC 103 ms
82,028 KB
testcase_08 AC 71 ms
78,056 KB
testcase_09 AC 99 ms
79,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
h='helloworld'

for _ in range(t):

    n=int(input())
    s=input()
    F = 0
    if n < 10:
        print(-1)
        continue

    ans=[]
    for i in range(n-len(h),-1,-1):
        f = 0
        an = []
        for j in range(len(h)):
            if s[i+j] == h[j] or s[i+j] == '?':
                continue
            else:
                f = 1
                break
        if f == 0:
            F=1
            for k in range(n):
                if i<= k  <= i + len(h) - 1:
                    an.append(h[k-i])
                else:
                    if s[k] =='?':
                        an.append('a')
                    else:
                        an.append(s[k])
            ans.append(an)
            
    if F == 0:
        print(-1)
    else:
        ans.sort()
        print(''.join(ans[0]))
0