結果

問題 No.2226 Hello, Forgotten World!
ユーザー buey_tbuey_t
提出日時 2023-02-25 00:07:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 374 ms / 2,000 ms
コード長 1,707 bytes
コンパイル時間 320 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 96,624 KB
最終ジャッジ日時 2023-10-11 07:07:24
合計ジャッジ時間 4,040 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 241 ms
91,924 KB
testcase_01 AC 374 ms
96,624 KB
testcase_02 AC 284 ms
95,600 KB
testcase_03 AC 281 ms
94,984 KB
testcase_04 AC 257 ms
93,300 KB
testcase_05 AC 280 ms
95,004 KB
testcase_06 AC 268 ms
93,852 KB
testcase_07 AC 268 ms
94,036 KB
testcase_08 AC 254 ms
93,240 KB
testcase_09 AC 272 ms
93,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    try:
        import pypyjit
        pypyjit.set_param('max_unroll_recursion=-1')
    except:
        pass
    try:
        import sys
        sys.setrecursionlimit(10**7)
    except:
        pass
    from math import sqrt,sin,cos,tan,ceil,radians,floor,gcd,exp,log,log10,log2,factorial,fsum
    import heapq
    from bisect import bisect_left, bisect_right
    import copy
    from collections import deque,Counter,defaultdict
    from itertools import permutations,combinations
    from decimal import Decimal,ROUND_HALF_UP
    #tmp = Decimal(mid).quantize(Decimal('0'), rounding=ROUND_HALF_UP)
    from functools import lru_cache, reduce
    #@lru_cache(maxsize=None)
    from operator import add,sub,mul,xor,and_,or_
    INF = 10**18
    mod1 = 10**9+7
    mod2 = 998244353
    
    #DecimalならPython
    
    hello = 'helloworld'
    
    for _ in range(int(input())):
        N = int(input())
        S = list(input())
        
        ans = []
        
        for i in range(N-9):
            f = True
            for j in range(10):
                if S[i+j] != hello[j] and S[i+j] != '?':
                    f = False
                    break
            if f == True:
                tmp = list(S)
                for j in range(10):
                    tmp[i+j] = hello[j]
                for j in range(N):
                    if tmp[j] == '?':
                        tmp[j] = 'a'
                ans.append(''.join(tmp))
        
        if len(ans) == 0:
            print(-1)
            continue
        
        ans.sort()
        print(ans[0])
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
if __name__ == '__main__':
    main()
0