結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,460 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 39 ms
53,460 KB
testcase_03 AC 38 ms
53,460 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 38 ms
53,460 KB
testcase_10 AC 39 ms
53,460 KB
testcase_11 AC 38 ms
53,460 KB
testcase_12 AC 38 ms
53,460 KB
testcase_13 AC 39 ms
53,460 KB
testcase_14 AC 38 ms
53,460 KB
testcase_15 AC 234 ms
147,416 KB
testcase_16 AC 782 ms
148,836 KB
testcase_17 AC 39 ms
53,460 KB
testcase_18 AC 39 ms
53,460 KB
testcase_19 AC 39 ms
53,460 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
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 count<0 or (S[i][j]=='.' and count>0):
      p=[0]
      print(p[1])
    if S[i][j]=='#':
      if count==0:
        print('No')
        exit()
p=[0]
print('Yes')
0