結果

問題 No.179 塗り分け
ユーザー kg_curry57kg_curry57
提出日時 2018-06-19 15:53:02
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 227 ms / 3,000 ms
コード長 1,085 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 10,788 KB
実行使用メモリ 8,536 KB
最終ジャッジ日時 2023-09-30 21:01:17
合計ジャッジ時間 3,459 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,896 KB
testcase_01 AC 16 ms
7,812 KB
testcase_02 AC 16 ms
7,732 KB
testcase_03 AC 16 ms
7,816 KB
testcase_04 AC 17 ms
7,780 KB
testcase_05 AC 28 ms
8,340 KB
testcase_06 AC 17 ms
8,268 KB
testcase_07 AC 16 ms
8,356 KB
testcase_08 AC 17 ms
8,344 KB
testcase_09 AC 17 ms
8,348 KB
testcase_10 AC 18 ms
8,456 KB
testcase_11 AC 18 ms
8,452 KB
testcase_12 AC 227 ms
8,536 KB
testcase_13 AC 16 ms
7,884 KB
testcase_14 AC 16 ms
7,812 KB
testcase_15 AC 16 ms
8,176 KB
testcase_16 AC 17 ms
7,852 KB
testcase_17 AC 16 ms
7,872 KB
testcase_18 AC 19 ms
8,336 KB
testcase_19 AC 19 ms
8,432 KB
testcase_20 AC 117 ms
8,444 KB
testcase_21 AC 34 ms
8,400 KB
testcase_22 AC 36 ms
8,244 KB
testcase_23 AC 17 ms
8,288 KB
testcase_24 AC 30 ms
8,268 KB
testcase_25 AC 17 ms
8,280 KB
testcase_26 AC 19 ms
8,336 KB
testcase_27 AC 76 ms
8,296 KB
testcase_28 AC 19 ms
8,300 KB
testcase_29 AC 107 ms
8,284 KB
testcase_30 AC 53 ms
8,348 KB
testcase_31 AC 128 ms
8,320 KB
testcase_32 AC 41 ms
8,464 KB
testcase_33 AC 132 ms
8,408 KB
testcase_34 AC 33 ms
8,468 KB
testcase_35 AC 149 ms
8,460 KB
testcase_36 AC 17 ms
7,876 KB
testcase_37 AC 16 ms
7,804 KB
testcase_38 AC 16 ms
7,800 KB
testcase_39 AC 17 ms
7,772 KB
testcase_40 AC 17 ms
7,816 KB
testcase_41 AC 16 ms
7,804 KB
testcase_42 AC 16 ms
7,812 KB
testcase_43 AC 19 ms
8,216 KB
testcase_44 AC 29 ms
8,300 KB
testcase_45 AC 17 ms
7,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    h, w = map(int, input().split())
    s = [input() for i in range(h)]

    black = []
    for i in range(h):
        for j in range(w):
            if s[i][j] == "#":
                black.append((i, j))

    if len(black) > 0:
        cor = black[0]
        for i in range(1, len(black)):
            cor2 = black[i]
            d1, d2 = cor2[0] - cor[0], cor2[1] - cor[1]
            check = [[0 for k in range(w)] for i in range(h)]

            for j in range(1, len(black)):
                if i != j and check[black[j][0]][black[j][1]] == 0:
                    if 0 <= black[j][0]+d1 < h and 0 <= black[j][1]+d2 < w:
                        if s[black[j][0]+d1][black[j][1]+d2] == "#":
                            check[black[j][0]][black[j][1]] = 1
                            check[black[j][0]+d1][black[j][1]+d2] = 1
                            continue
                    break

            else:
                print("YES")
                break

        else:
            print("NO")

    else:
        print("NO")


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