結果
問題 | No.179 塗り分け |
ユーザー | rpy3cpp |
提出日時 | 2015-04-07 00:06:06 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 244 ms / 3,000 ms |
コード長 | 1,062 bytes |
コンパイル時間 | 114 ms |
コンパイル使用メモリ | 11,008 KB |
実行使用メモリ | 8,468 KB |
最終ジャッジ日時 | 2023-09-30 20:39:25 |
合計ジャッジ時間 | 3,814 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 17 ms
8,344 KB |
testcase_01 | AC | 19 ms
8,260 KB |
testcase_02 | AC | 16 ms
8,288 KB |
testcase_03 | AC | 17 ms
8,292 KB |
testcase_04 | AC | 17 ms
8,364 KB |
testcase_05 | AC | 27 ms
8,388 KB |
testcase_06 | AC | 17 ms
8,312 KB |
testcase_07 | AC | 18 ms
8,400 KB |
testcase_08 | AC | 56 ms
8,304 KB |
testcase_09 | AC | 98 ms
8,364 KB |
testcase_10 | AC | 17 ms
8,448 KB |
testcase_11 | AC | 17 ms
8,300 KB |
testcase_12 | AC | 110 ms
8,372 KB |
testcase_13 | AC | 17 ms
8,344 KB |
testcase_14 | AC | 17 ms
8,380 KB |
testcase_15 | AC | 16 ms
8,360 KB |
testcase_16 | AC | 16 ms
8,332 KB |
testcase_17 | AC | 16 ms
8,228 KB |
testcase_18 | AC | 17 ms
8,356 KB |
testcase_19 | AC | 18 ms
8,424 KB |
testcase_20 | AC | 79 ms
8,468 KB |
testcase_21 | AC | 132 ms
8,360 KB |
testcase_22 | AC | 244 ms
8,372 KB |
testcase_23 | AC | 17 ms
8,392 KB |
testcase_24 | AC | 102 ms
8,360 KB |
testcase_25 | AC | 17 ms
8,348 KB |
testcase_26 | AC | 59 ms
8,416 KB |
testcase_27 | AC | 81 ms
8,420 KB |
testcase_28 | AC | 49 ms
8,320 KB |
testcase_29 | AC | 79 ms
8,364 KB |
testcase_30 | AC | 62 ms
8,328 KB |
testcase_31 | AC | 78 ms
8,300 KB |
testcase_32 | AC | 25 ms
8,436 KB |
testcase_33 | AC | 84 ms
8,456 KB |
testcase_34 | AC | 57 ms
8,412 KB |
testcase_35 | AC | 84 ms
8,332 KB |
testcase_36 | AC | 17 ms
8,424 KB |
testcase_37 | AC | 17 ms
8,420 KB |
testcase_38 | AC | 17 ms
8,220 KB |
testcase_39 | AC | 17 ms
8,392 KB |
testcase_40 | AC | 16 ms
7,872 KB |
testcase_41 | AC | 17 ms
8,248 KB |
testcase_42 | AC | 17 ms
8,376 KB |
testcase_43 | AC | 19 ms
8,448 KB |
testcase_44 | AC | 26 ms
8,288 KB |
testcase_45 | AC | 17 ms
8,336 KB |
ソースコード
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] if has_no_sharp(Smat): return False 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 has_no_sharp(Smat): for row in Smat: if any(row): return False return True 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")