結果

問題 No.3261 yiwiy9 → yiwiY9
ユーザー 🦌せ
提出日時 2025-09-06 15:08:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 661 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 82,460 KB
実行使用メモリ 74,068 KB
最終ジャッジ日時 2025-09-06 15:09:00
合計ジャッジ時間 2,801 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

h,w = map(int,input().split())
s = [list(input()) for _ in range(h)]
if w > 5:
    for i in range(h):
        k = 0
        for j in range(w-5):
            j += k
            if j + 5 >= w:
                break
            if s[i][j] == "9" and s[i][j+1] == "y" and s[i][j+2] == "i" and s[i][j+3] == "w" and s[i][j+4] == "i" and s[i][j+5] == "y":
                s[i][j+1] = "Y"
                k += 5
            if s[i][j] == "y" and s[i][j+1] == "i" and s[i][j+2] == "w" and s[i][j+3] == "i" and s[i][j+4] == "y" and s[i][j+5] == "9":
                s[i][j+4] = "Y"
                k += 5
for A in s:
    t = ""
    for B in A:
        t += B
    print(t)
0