結果
問題 |
No.2226 Hello, Forgotten World!
|
ユーザー |
![]() |
提出日時 | 2023-02-25 00:07:30 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 289 ms / 2,000 ms |
コード長 | 1,707 bytes |
コンパイル時間 | 204 ms |
コンパイル使用メモリ | 82,400 KB |
実行使用メモリ | 90,236 KB |
最終ジャッジ日時 | 2024-09-13 06:18:07 |
合計ジャッジ時間 | 2,626 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
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()