結果

問題 No.179 塗り分け
ユーザー rpy3cpprpy3cpp
提出日時 2015-04-06 23:49:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 791 bytes
コンパイル時間 333 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-10 11:45:09
合計ジャッジ時間 3,407 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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):
        for w in range(W):
            if h == w == 0:
                continue
            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+h][y+w] = False
    return True

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