結果
問題 |
No.179 塗り分け
|
ユーザー |
|
提出日時 | 2015-04-06 23:46:40 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 795 bytes |
コンパイル時間 | 200 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-10-02 13:43:50 |
合計ジャッジ時間 | 3,335 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 33 WA * 7 |
ソースコード
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 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")