結果
| 問題 |
No.179 塗り分け
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-04-16 14:41:32 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 1,814 ms / 3,000 ms |
| コード長 | 939 bytes |
| コンパイル時間 | 82 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 11,264 KB |
| 最終ジャッジ日時 | 2024-10-11 23:41:47 |
| 合計ジャッジ時間 | 11,504 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 40 |
ソースコード
def res():
import copy
H,W=map(int,input().split())
S=[[None] for _ in range(H)]
for i in range(H):
S[i]=list(input())
b=[]
for i in range(H):
for j in range(W):
if S[i][j]=='#':
b.append([i,j])
if (len(b)>1)and(len(b)%2==0):
o=b[0]
for i in b:
if i==b[0]:
continue
l1=i[0]-o[0]
l2=i[1]-o[1]
t=copy.deepcopy(S)
for j in b:
if t[j[0]][j[1]]=='B':
if j==b[-1]:
return 'YES'
continue
if (0<=(j[0]+l1)<H)and(0<=(j[1]+l2)<W):
if t[j[0]+l1][(j[1]+l2)]=='#':
t[j[0]+l1][(j[1]+l2)]='B'
else:
break
else:
break
return 'NO'
return 'NO'
print(res())