結果
問題 | No.179 塗り分け |
ユーザー |
|
提出日時 | 2015-04-06 23:40:51 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 742 bytes |
コンパイル時間 | 159 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-10-02 13:43:14 |
合計ジャッジ時間 | 2,815 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 3 |
other | AC * 15 WA * 25 |
ソースコード
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+h][y+w] = False return True H, W, S = read_data() if solve(H, W, S): print("YES") else: print("NO")