結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,752 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 27 ms
10,752 KB
testcase_03 AC 27 ms
10,752 KB
testcase_04 AC 27 ms
10,752 KB
testcase_05 AC 35 ms
10,880 KB
testcase_06 AC 28 ms
10,880 KB
testcase_07 WA -
testcase_08 AC 54 ms
10,880 KB
testcase_09 AC 84 ms
10,880 KB
testcase_10 AC 27 ms
10,880 KB
testcase_11 AC 27 ms
10,880 KB
testcase_12 AC 96 ms
10,880 KB
testcase_13 AC 27 ms
10,752 KB
testcase_14 AC 27 ms
10,752 KB
testcase_15 AC 28 ms
10,880 KB
testcase_16 AC 26 ms
10,752 KB
testcase_17 AC 28 ms
10,752 KB
testcase_18 AC 28 ms
10,880 KB
testcase_19 AC 28 ms
11,008 KB
testcase_20 AC 87 ms
10,880 KB
testcase_21 AC 118 ms
10,880 KB
testcase_22 AC 204 ms
10,880 KB
testcase_23 AC 28 ms
10,880 KB
testcase_24 AC 93 ms
10,880 KB
testcase_25 AC 28 ms
11,008 KB
testcase_26 AC 58 ms
10,880 KB
testcase_27 AC 83 ms
10,880 KB
testcase_28 AC 56 ms
10,880 KB
testcase_29 AC 82 ms
10,880 KB
testcase_30 AC 68 ms
10,880 KB
testcase_31 AC 84 ms
10,880 KB
testcase_32 AC 36 ms
10,880 KB
testcase_33 AC 86 ms
10,880 KB
testcase_34 AC 61 ms
10,880 KB
testcase_35 AC 88 ms
10,880 KB
testcase_36 AC 30 ms
10,624 KB
testcase_37 AC 28 ms
10,752 KB
testcase_38 AC 27 ms
10,752 KB
testcase_39 AC 27 ms
10,880 KB
testcase_40 AC 26 ms
10,752 KB
testcase_41 AC 26 ms
10,752 KB
testcase_42 AC 26 ms
10,752 KB
testcase_43 AC 30 ms
10,752 KB
testcase_44 AC 35 ms
10,880 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:
    Sreverse = [list(reversed(row)) for row in S]
    if solve(H, W, Sreverse):
        print("YES")
    else:
        print("NO")
0