結果
| 問題 |
No.179 塗り分け
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-23 14:14:34 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,263 ms / 3,000 ms |
| コード長 | 1,462 bytes |
| コンパイル時間 | 457 ms |
| コンパイル使用メモリ | 82,260 KB |
| 実行使用メモリ | 83,340 KB |
| 最終ジャッジ日時 | 2024-07-23 15:18:17 |
| 合計ジャッジ時間 | 18,591 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 40 |
ソースコード
H, W = map(int, input().split())
S = [[1 if i == '#' else 0 for i in input()] for _ in range(H)]
from copy import deepcopy
if sum([sum(s) for s in S]) < 2:
print('NO')
exit()
for i in range(H):
for j in range(-W + 1, W):
if i == 0 and j <= 0:
continue
else:
s = deepcopy(S)
B = True
for h in range(H):
if B:
for w in range(W):
if s[h][w] == 1:
s[h][w] = 0
if h + i < H and 0 <= w + j < W and s[h + i][w + j]:
s[h + i][w + j] = 0
else:
B = False
break
else:
break
if B:
print('YES')
exit()
print('NO')