結果
| 問題 | No.179 塗り分け |
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-02-02 13:47:20 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 749 ms / 3,000 ms |
| コード長 | 849 bytes |
| コンパイル時間 | 133 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-07-23 15:04:53 |
| 合計ジャッジ時間 | 4,241 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 40 |
ソースコード
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import itertools
H,W = map(int,readline().split())
data = ''.join(read().decode().split())
if not data.count('#'):
print('NO')
exit()
def test(a,b):
if a==b==0:
return False
close = [0] * (H*W)
for x,y in itertools.product(range(H), range(W)):
ind = W*x + y
if close[ind]:
continue
if data[ind] == '.':
continue
x1,y1 = x+a, y+b
if x1 >= H or y1 < 0 or y1 >= W:
return False
ind1 = W*x1 + y1
if data[ind1] == '.':
return False
close[ind] = 1
close[ind1] = 1
return True
bl = any(test(a,b) for a in range(51) for b in range(-51,51))
answer = 'YES' if bl else 'NO'
print(answer)
maspy