結果

問題 No.2641 draw X
ユーザー ゼットゼット
提出日時 2024-02-19 22:37:11
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,282 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 149,492 KB
最終ジャッジ日時 2024-02-19 22:37:24
合計ジャッジ時間 12,295 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 37 ms
53,460 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 39 ms
53,460 KB
testcase_10 AC 39 ms
53,460 KB
testcase_11 AC 38 ms
53,460 KB
testcase_12 AC 37 ms
53,460 KB
testcase_13 AC 38 ms
53,460 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 37 ms
53,460 KB
testcase_19 AC 38 ms
53,460 KB
testcase_20 AC 134 ms
84,824 KB
testcase_21 AC 151 ms
86,236 KB
testcase_22 AC 142 ms
83,300 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 AC 100 ms
79,636 KB
testcase_26 RE -
testcase_27 AC 155 ms
81,636 KB
testcase_28 AC 161 ms
90,544 KB
testcase_29 RE -
testcase_30 RE -
testcase_31 AC 249 ms
95,200 KB
testcase_32 RE -
testcase_33 AC 563 ms
110,316 KB
testcase_34 AC 269 ms
95,728 KB
testcase_35 AC 437 ms
95,580 KB
testcase_36 RE -
testcase_37 AC 1,048 ms
145,904 KB
testcase_38 AC 406 ms
137,560 KB
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 AC 508 ms
137,912 KB
testcase_43 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W=map(int,input().split())
S=[input() for i in range(H)]
cnt0=[[0]*(H+W) for i in range(H)]
cnt1=[[0]*(H+W) for i in range(H)]
for i in range(H):
  for j in range(W):
    if S[i][j]=='#':
      cnt0[i][i-j]+=1
      cnt1[i][i+j]+=1
for i in range(1,H):
  for j in range(H+W):
    cnt0[i][j]+=cnt0[i-1][j]
    cnt1[i][j]+=cnt1[i-1][j]
result0=[[0]*(H+W) for i in range(H)]
result1=[[0]*(H+W) for i in range(H)]
p=[[0]*W for i in range(H)]
for i in range(1,H-1):
  for j in range(1,W-1):
    if S[i][j]=='.':
      continue
    l=0
    r=min(i,H-1-i,j,W-1-j)
    while True:
      m=(l+r+1)//2
      k1=cnt0[i+m][i-j]
      k2=cnt1[i+m][i+j]
      if i-m>0:
        k1-=cnt0[i-m-1][i-j]
        k2-=cnt1[i-m-1][i+j]
      if k1+k2==2*(2*m+1):
        l=m
      else:
        r=m-1
      if l==r:
        break
    if l>0:
      result0[i-m][i-j]+=1
      result1[i-m][i+j]+=1
      p[i][j]+=1
      if i+m+1<H:
        result0[i+m+1][i-j]-=1
        result1[i+m+1][i+j]-=1
for i in range(1,H):
  for j in range(H+W):
    result0[i][j]+=result0[i-1][j]
    result1[i][j]+=result1[i-1][j]
for i in range(H):
  for j in range(W):
    count=result0[i][i-j]+result1[i][i+j]-p[i][j]
    if S[i][j]=='#':
      if count==0:
        print('No')
        exit()
p=[0]
print(p[1])
print('Yes')
0