結果
問題 | No.2226 Hello, Forgotten World! |
ユーザー | buey_t |
提出日時 | 2023-02-24 23:42:41 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,427 bytes |
コンパイル時間 | 168 ms |
コンパイル使用メモリ | 82,260 KB |
実行使用メモリ | 89,520 KB |
最終ジャッジ日時 | 2024-09-13 06:12:38 |
合計ジャッジ時間 | 2,283 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 129 ms
84,812 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
ソースコード
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 for _ in range(int(input())): N = int(input()) S = list(input()) ans = [] for i in range(N-9): f2 = False if S[i] == 'h' or S[i] == '?': if S[i] == '?': f2 = True if S[i+1] == 'e' or S[i+1] == '?' : if S[i+1] == '?': f2 = True if S[i+2] == 'l' or S[i+2] == '?' : if S[i+2] == '?': f2 = True if S[i+3] == 'l' or S[i+3] == '?' : if S[i+3] == '?': f2 = True if S[i+4] == 'o' or S[i+4] == '?' : if S[i+4] == '?': f2 = True if S[i+5] == 'w' or S[i+5] == '?' : if S[i+5] == '?': f2 = True if S[i+6] == 'o' or S[i+6] == '?' : if S[i+6] == '?': f2 = True if S[i+7] == 'r' or S[i+7] == '?' : if S[i+7] == '?': f2 = True if S[i+8] == 'l' or S[i+8] == '?' : if S[i+8] == '?': f2 = True if S[i+9] == 'd' or S[i+9] == '?' : if S[i+9] == '?': f2 = True ans.append(i) if f2 == False: break if len(ans): i = ans[-1] S[i] = 'h' S[i+1] = 'e' S[i+2] = 'l' S[i+3] = 'l' S[i+4] = 'o' S[i+5] = 'w' S[i+6] = 'o' S[i+7] = 'r' S[i+8] = 'l' S[i+9] = 'd' for i in range(N): if S[i] == '?': S[i] = 'a' print(''.join(S)) else: print(-1) if __name__ == '__main__': main()