結果

問題 No.2946 Puyo
ユーザー kitsne241
提出日時 2024-10-25 22:20:00
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 1,478 bytes
コンパイル時間 200 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 133,036 KB
最終ジャッジ日時 2024-10-25 22:20:08
合計ジャッジ時間 7,753 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other TLE * 1 -- * 44
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

ways = [
    [1 + 0j, 2 + 0j, 3 + 0j],
    [1 + 0j, 2 + 0j, 2 + 1j],
    [1 + 0j, 1 + 1j, 2 + 1j],
    [1 + 0j, 1 + 1j, 1 + 2j],
    [1 + 0j, 1 + 1j, 0 + 1j],
]


def main():
    H, W = [int(a) for a in input().split(" ")]
    grid = dict()
    # grid = [["." for j in range(W + 6)] for i in range(H + 6)]
    for a in range(H - 1, -1, -1):
        k = list(input())
        for b in range(len(k)):
            grid[complex(b, a)] = k[b]
    # print(grid)

    erasable = dict()
    for a in range(H - 1, -1, -1):
        for b in range(W):
            x = grid[complex(b, a)]
            for way in ways:
                w = way
                for _ in range(4):
                    four = True
                    for step in w:
                        if grid.get(complex(b, a) + step) != x:
                            four = False
                    if four:
                        erasable[complex(b, a)] = True
                        # print(complex(b, a))
                        for step in w:
                            erasable[complex(b, a) + step] = True
                            # print(complex(b, a) + step)

                        # print()

                    w = [step * (0 + 1j) for step in w]

    for a in range(H - 1, -1, -1):
        for b in range(W):
            if erasable.get(complex(b, a)):
                print(".", end="")
            else:
                print(grid[complex(b, a)], end="")
        print()


main()
0