結果
| 問題 |
No.2226 Hello, Forgotten World!
|
| コンテスト | |
| ユーザー |
maron8676
|
| 提出日時 | 2023-02-24 22:06:52 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,090 bytes |
| コンパイル時間 | 205 ms |
| コンパイル使用メモリ | 81,608 KB |
| 実行使用メモリ | 64,616 KB |
| 最終ジャッジ日時 | 2024-09-13 05:32:06 |
| 合計ジャッジ時間 | 1,259 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 9 |
ソースコード
from collections import defaultdict, deque
from sys import stdin
readline = stdin.readline
def li():
return list(map(int, readline().split()))
T = int(input())
case_list = []
for _ in range(T):
N = int(input())
case_list.append(list(input()))
# 後ろから探して最初に見つけた場所をhelloworldにする
# 残りの?にはaを入れる
hello = list('helloworld')
for case_s in case_list:
index = 9
possible = False
for i in range(len(case_s) - 1, -1, -1):
if case_s[i] == '?' or case_s[i] == hello[index]:
index -= 1
else:
if case_s[i] == '?' or case_s[i] == hello[9]:
index = 8
else:
index = 9
if index == -1:
# helloworldを確定
for j in range(10):
case_s[i + j] = hello[j]
for j in range(len(case_s)):
if case_s[j] == '?':
case_s[j] = 'a'
possible = True
break
if possible:
print(''.join(case_s))
else:
print(-1)
maron8676