結果

問題 No.3261 yiwiy9 → yiwiY9
ユーザー しもりん
提出日時 2025-09-06 14:09:33
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,269 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 81,980 KB
実行使用メモリ 79,024 KB
最終ジャッジ日時 2025-09-06 14:09:40
合計ジャッジ時間 3,847 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter, deque, defaultdict
from heapq import heapify, heappop, heappush, nlargest, nsmallest
from bisect import bisect_left, bisect, bisect_right
from string import ascii_lowercase, ascii_uppercase, digits
from copy import deepcopy
from time import perf_counter
import sys
import os
from typing import Any, List, Callable


IS_LOCAL = os.environ.get("LOCAL") == "true"


def debug(*args, sep=" ", end="\n", flush=False) -> None:
    if IS_LOCAL:
        print(*args, sep=sep, end=end, file=sys.stderr, flush=flush)


def yn(flg: bool) -> bool:
    print('Yes' if flg else 'No')
    return flg


def gcd(a, b):
    a = abs(a); b = abs(b)
    if a < b: a, b = b, a
    while b > 0:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd(a, b)


def main():
    readline = sys.stdin.readline
    inf = 1e18
    MOD = 998244353

    H, W = map(int, readline().split())
    right_yiwiy = "yiwiy9"
    left_yiwiy = "9yiwiy"
    for _ in range(H):
        s = list(input())
        for i in range(W - 5):
            if s[i:i + 6] == list(right_yiwiy):
                s[i + 4] = 'Y'
            if s[i:i + 6] == list(left_yiwiy):
                s[i + 2] = 'Y'
        print(''.join(s))


if __name__ == "__main__":
    main()
0