結果

問題 No.179 塗り分け
ユーザー rpy3cpprpy3cpp
提出日時 2015-04-06 23:43:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 782 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-10 11:44:13
合計ジャッジ時間 2,813 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 WA -
testcase_02 AC 33 ms
10,752 KB
testcase_03 WA -
testcase_04 AC 31 ms
10,752 KB
testcase_05 WA -
testcase_06 AC 32 ms
10,752 KB
testcase_07 WA -
testcase_08 AC 31 ms
10,752 KB
testcase_09 AC 31 ms
10,880 KB
testcase_10 AC 31 ms
10,880 KB
testcase_11 AC 31 ms
10,752 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 30 ms
10,880 KB
testcase_17 WA -
testcase_18 AC 32 ms
11,008 KB
testcase_19 AC 31 ms
10,880 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 31 ms
10,752 KB
testcase_24 WA -
testcase_25 AC 31 ms
10,880 KB
testcase_26 AC 31 ms
10,752 KB
testcase_27 WA -
testcase_28 AC 30 ms
10,880 KB
testcase_29 WA -
testcase_30 AC 30 ms
10,752 KB
testcase_31 WA -
testcase_32 AC 30 ms
10,880 KB
testcase_33 WA -
testcase_34 AC 30 ms
10,880 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def read_data():
    H, W = map(int, input().split())
    S = [input() for i in range(H)]
    return H, W, S

def solve(H, W, S):
    Smat = [[c == '#' for c in row] for row in S]
    for h in range(H+1):
        for w in range(W+1):
            if can_be_painted(h, w, Smat, H, W):
                return True
    return False

def can_be_painted(h, w, Smat, H, W):
    Scopy = [row[:] for row in Smat]
    for x in range(H):
        for y in range(W):
            if Scopy[x][y]:
                if x+h >= H or y+w >= W or not Scopy[x+h][y+w]:
                    return False
                else:
                    Scopy[x][y] = False
                    Scopy[x+h][y+w] = False
    return True

H, W, S = read_data()
if solve(H, W, S):
    print("YES")
else:
    print("NO")
0