結果

問題 No.179 塗り分け
ユーザー Woo-CieWoo-Cie
提出日時 2019-03-23 11:47:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,702 ms / 3,000 ms
コード長 1,004 bytes
コンパイル時間 134 ms
コンパイル使用メモリ 10,964 KB
実行使用メモリ 29,744 KB
最終ジャッジ日時 2023-09-30 21:08:59
合計ジャッジ時間 12,129 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
29,536 KB
testcase_01 AC 130 ms
29,472 KB
testcase_02 AC 132 ms
29,612 KB
testcase_03 AC 131 ms
29,588 KB
testcase_04 AC 131 ms
29,568 KB
testcase_05 AC 148 ms
29,592 KB
testcase_06 AC 135 ms
29,596 KB
testcase_07 AC 130 ms
29,544 KB
testcase_08 AC 150 ms
29,744 KB
testcase_09 AC 224 ms
29,596 KB
testcase_10 AC 133 ms
29,624 KB
testcase_11 AC 132 ms
29,600 KB
testcase_12 AC 271 ms
29,560 KB
testcase_13 AC 131 ms
29,568 KB
testcase_14 AC 130 ms
29,640 KB
testcase_15 AC 130 ms
29,464 KB
testcase_16 AC 130 ms
29,588 KB
testcase_17 AC 130 ms
29,368 KB
testcase_18 AC 131 ms
29,620 KB
testcase_19 AC 134 ms
29,584 KB
testcase_20 AC 188 ms
29,624 KB
testcase_21 AC 585 ms
29,500 KB
testcase_22 AC 1,702 ms
29,484 KB
testcase_23 AC 129 ms
29,632 KB
testcase_24 AC 243 ms
29,608 KB
testcase_25 AC 132 ms
29,504 KB
testcase_26 AC 139 ms
29,548 KB
testcase_27 AC 157 ms
29,500 KB
testcase_28 AC 133 ms
29,648 KB
testcase_29 AC 151 ms
29,564 KB
testcase_30 AC 151 ms
29,576 KB
testcase_31 AC 177 ms
29,520 KB
testcase_32 AC 139 ms
29,592 KB
testcase_33 AC 157 ms
29,604 KB
testcase_34 AC 136 ms
29,604 KB
testcase_35 AC 162 ms
29,596 KB
testcase_36 AC 131 ms
29,552 KB
testcase_37 AC 132 ms
29,468 KB
testcase_38 AC 131 ms
29,496 KB
testcase_39 AC 128 ms
29,564 KB
testcase_40 AC 130 ms
29,472 KB
testcase_41 AC 130 ms
29,604 KB
testcase_42 AC 129 ms
29,468 KB
testcase_43 AC 132 ms
29,728 KB
testcase_44 AC 136 ms
29,472 KB
testcase_45 AC 132 ms
29,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# -*- coding: utf-8-*-
import numpy as np
def f(i, j, h, w, tl):
    for a in range(h):
        for b in range(w):
            if tl[a, b] == "#":
                if a+i >= h:
                    return False
                elif b+j >= w:
                    return False
                elif b+j < 0:
                    return False
                elif tl[a+i, b+j] == "#":
                    tl[a,b] = "."
                    tl[a+i, b+j] = "."
                else:
                    return False
    return True

if __name__ == '__main__':
    h, w = map(int, input().split(" "))
    l = []
    for i in range(h):
        l.append(list(input()))
    l = np.array(l)
    if not "#" in l:
        print("NO")
        exit()
    for i in range(h):
        for j in range(-w+1, w):
            if i == 0 and j == 0:
                continue
            flag = f(i, j, h, w, np.copy(l))
            if flag:
                print("YES")
                exit()
    print("NO")
0