結果

問題 No.179 塗り分け
ユーザー 12354865271235486527
提出日時 2019-11-30 14:06:37
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 880 ms / 3,000 ms
コード長 797 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 10,984 KB
実行使用メモリ 8,344 KB
最終ジャッジ日時 2023-09-30 21:14:50
合計ジャッジ時間 4,677 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,188 KB
testcase_01 AC 16 ms
7,820 KB
testcase_02 AC 16 ms
8,244 KB
testcase_03 AC 15 ms
7,808 KB
testcase_04 AC 15 ms
8,136 KB
testcase_05 AC 27 ms
7,892 KB
testcase_06 AC 16 ms
8,252 KB
testcase_07 AC 880 ms
8,000 KB
testcase_08 AC 83 ms
8,268 KB
testcase_09 AC 96 ms
8,184 KB
testcase_10 AC 16 ms
8,308 KB
testcase_11 AC 17 ms
8,300 KB
testcase_12 AC 107 ms
7,788 KB
testcase_13 AC 16 ms
7,872 KB
testcase_14 AC 15 ms
7,892 KB
testcase_15 AC 15 ms
7,800 KB
testcase_16 AC 15 ms
8,184 KB
testcase_17 AC 15 ms
7,788 KB
testcase_18 AC 17 ms
8,224 KB
testcase_19 AC 18 ms
8,168 KB
testcase_20 AC 88 ms
7,856 KB
testcase_21 AC 169 ms
7,816 KB
testcase_22 AC 395 ms
7,852 KB
testcase_23 AC 17 ms
8,280 KB
testcase_24 AC 102 ms
7,804 KB
testcase_25 AC 17 ms
8,256 KB
testcase_26 AC 27 ms
8,328 KB
testcase_27 AC 84 ms
7,872 KB
testcase_28 AC 19 ms
8,256 KB
testcase_29 AC 83 ms
7,820 KB
testcase_30 AC 46 ms
8,168 KB
testcase_31 AC 88 ms
7,860 KB
testcase_32 AC 35 ms
8,344 KB
testcase_33 AC 86 ms
7,788 KB
testcase_34 AC 28 ms
8,212 KB
testcase_35 AC 85 ms
7,868 KB
testcase_36 AC 16 ms
7,828 KB
testcase_37 AC 15 ms
7,968 KB
testcase_38 AC 15 ms
7,956 KB
testcase_39 AC 15 ms
7,916 KB
testcase_40 AC 15 ms
7,872 KB
testcase_41 AC 15 ms
7,784 KB
testcase_42 AC 15 ms
7,828 KB
testcase_43 AC 18 ms
7,868 KB
testcase_44 AC 26 ms
7,864 KB
testcase_45 AC 15 ms
7,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

H, W = map(int, input().split())
S = [input() for _ in range(H)]

def func(ty, tx):
    if tx == 0 and ty == 0:
        return False
    CL = [[False] * W for _ in range(H)]
    is_exist = False
    for y in range(H):
        for x in range(W):
            if S[y][x] == "#" and CL[y][x] == False:
                if x+tx >= W or x+tx < 0 or y+ty >= H:
                    return False
                if S[y+ty][x+tx] == "#" and CL[y+ty][x+tx] == False:
                    is_exist = True
                    CL[y][x] = True
                    CL[y+ty][x+tx] = True
                else:
                    return False
    return (True if is_exist else False)

for ty in range(H):
    for tx in range(-W+1,W):
        if func(ty, tx):
            print("YES")
            exit()

print("NO")
0