提出 #69501655


ソースコード 拡げる

def check_4(x, y, field):
    return (field[x - 1][y - 1] == field[x - 1][y] ==
            field[x][y - 1]     == field[x][y] == "#")

def check_9(x, y, field):
    arr = [(-1, 0), (-1, 1), (0, -1),(0, 0), (0, 1),(1, -1), (1, 0)]
    for dx, dy in arr:
        if not (0 <= x + dx < len(field) and 0 <= y + dy < len(field[0])):
            return False
        if field[x + dx][y + dy] != "#":
            return False

    return True

for _ in range(int(input())):
    h, w = map(int, input().split())
    s = [list(input()) for _ in range(h)]
    ans = 0
    for i in range(1, h):
        for j in range(1, w):
            if check_4(i, j, s) or check_9(i, j, s):
                ans += 1
                s[i][j] = "."
    print(ans)

"""

.##...
###...
###...
....##
...###
...##.

"""

提出情報

提出日時
問題 D - 2x2 Erasing 2
ユーザ hyouri
言語 Python (PyPy 3.10-v7.3.12)
得点 0
コード長 826 Byte
結果 WA
実行時間 96 ms
メモリ 83860 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 0 / 425
結果
AC × 1
AC × 9
WA × 18
セット名 テストケース
Sample example_00.txt
All example_00.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt
ケース名 結果 実行時間 メモリ
example_00.txt AC 62 ms 76472 KiB
hand_00.txt AC 86 ms 82004 KiB
hand_01.txt AC 78 ms 81776 KiB
hand_02.txt AC 90 ms 82184 KiB
hand_03.txt WA 63 ms 76764 KiB
hand_04.txt WA 88 ms 81988 KiB
hand_05.txt AC 63 ms 76508 KiB
random_00.txt AC 74 ms 81480 KiB
random_01.txt AC 88 ms 82080 KiB
random_02.txt AC 83 ms 81472 KiB
random_03.txt AC 88 ms 82000 KiB
random_04.txt WA 85 ms 82140 KiB
random_05.txt WA 77 ms 81560 KiB
random_06.txt WA 85 ms 81584 KiB
random_07.txt WA 86 ms 82220 KiB
random_08.txt WA 84 ms 81560 KiB
random_09.txt WA 83 ms 81652 KiB
random_10.txt WA 86 ms 82996 KiB
random_11.txt WA 83 ms 81596 KiB
random_12.txt WA 86 ms 82008 KiB
random_13.txt WA 96 ms 83860 KiB
random_14.txt WA 84 ms 82048 KiB
random_15.txt WA 75 ms 81480 KiB
random_16.txt WA 85 ms 81560 KiB
random_17.txt WA 86 ms 82088 KiB
random_18.txt WA 87 ms 82032 KiB
random_19.txt WA 85 ms 81776 KiB