結果
| 問題 | No.179 塗り分け |
| コンテスト | |
| ユーザー |
nisizawa
|
| 提出日時 | 2017-12-11 19:44:49 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 426 ms / 3,000 ms |
| コード長 | 908 bytes |
| コンパイル時間 | 288 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-07-23 14:45:02 |
| 合計ジャッジ時間 | 5,483 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 40 |
ソースコード
def solve(h, w, map_ls):
ct = map_ls.count('#')
if ct == 0 or ct % 2 == 1:
return 'NO'
for dx in range(-(w - 1), w):
for dy in range(h):
if dx <= 0 and dy == 0:
continue
memo = [c for c in map_ls]
for i_s, m in enumerate(memo):
if m == '.':
continue
sx, sy = i_s % w, i_s // w
gx, gy = sx + dx, sy + dy
i_g = w * gy + gx
if not (0 <= gx < w and 0 <= gy < h):
break
if not memo[i_g] == '#':
break
memo[i_s] = '.'
memo[i_g] = '.'
else:
if not '#' in memo:
return 'YES'
return 'NO'
h, w = map(int, input().split())
map_ls = [c for i in range(h) for c in input()]
print(solve(h, w, map_ls))
nisizawa