結果

問題 No.179 塗り分け
ユーザー takakintakakin
提出日時 2020-04-21 22:17:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 570 ms / 3,000 ms
コード長 1,160 bytes
コンパイル時間 250 ms
コンパイル使用メモリ 86,872 KB
実行使用メモリ 78,952 KB
最終ジャッジ日時 2023-09-30 21:26:40
合計ジャッジ時間 13,869 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,348 KB
testcase_01 AC 72 ms
71,124 KB
testcase_02 AC 73 ms
71,256 KB
testcase_03 AC 73 ms
70,996 KB
testcase_04 AC 80 ms
76,108 KB
testcase_05 AC 167 ms
78,004 KB
testcase_06 AC 151 ms
77,508 KB
testcase_07 AC 245 ms
77,156 KB
testcase_08 AC 258 ms
77,592 KB
testcase_09 AC 254 ms
77,372 KB
testcase_10 AC 497 ms
78,892 KB
testcase_11 AC 444 ms
78,344 KB
testcase_12 AC 436 ms
78,084 KB
testcase_13 AC 80 ms
75,748 KB
testcase_14 AC 84 ms
76,584 KB
testcase_15 AC 71 ms
71,012 KB
testcase_16 AC 72 ms
71,288 KB
testcase_17 AC 72 ms
71,032 KB
testcase_18 AC 409 ms
78,176 KB
testcase_19 AC 416 ms
78,404 KB
testcase_20 AC 360 ms
77,800 KB
testcase_21 AC 308 ms
77,656 KB
testcase_22 AC 358 ms
78,488 KB
testcase_23 AC 410 ms
78,380 KB
testcase_24 AC 291 ms
77,940 KB
testcase_25 AC 322 ms
78,488 KB
testcase_26 AC 379 ms
78,036 KB
testcase_27 AC 396 ms
77,808 KB
testcase_28 AC 489 ms
78,604 KB
testcase_29 AC 518 ms
78,436 KB
testcase_30 AC 535 ms
78,764 KB
testcase_31 AC 543 ms
78,428 KB
testcase_32 AC 552 ms
78,532 KB
testcase_33 AC 515 ms
78,416 KB
testcase_34 AC 570 ms
78,952 KB
testcase_35 AC 538 ms
78,380 KB
testcase_36 AC 73 ms
70,880 KB
testcase_37 AC 71 ms
71,200 KB
testcase_38 AC 73 ms
71,104 KB
testcase_39 AC 72 ms
71,180 KB
testcase_40 AC 74 ms
71,072 KB
testcase_41 AC 70 ms
71,256 KB
testcase_42 AC 71 ms
71,240 KB
testcase_43 AC 128 ms
77,576 KB
testcase_44 AC 174 ms
78,076 KB
testcase_45 AC 118 ms
77,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
h,w=map(int,input().split())
S=[input() for _ in range(h)]
chk=False
for i in range(h):
  for j in range(w):
    for sign in range(2):
      if i==0 and j==0:
        continue
      else:
        cur=True
        ct=0
        C=[[False]*w for _ in range(h)]
        if sign==0:
          for ii in range(h):
            for jj in range(w):
              if S[ii][jj]==".":
                continue
              else:
                ct+=1
                if C[ii][jj]==False:
                  if 0<=ii+i<h and 0<=jj+j<w and S[ii+i][jj+j]=="#":
                    C[ii+i][jj+j]=True
                  else:
                    cur=False
        else:
          for ii in range(h)[::-1]:
            for jj in range(w):
              if S[ii][jj]==".":
                continue
              else:
                ct+=1
                if C[ii][jj]==False:
                  if 0<=ii-i<h and 0<=jj+j<w and S[ii-i][jj+j]=="#":
                    C[ii-i][jj+j]=True
                  else:
                    cur=False
        if cur and ct:
          chk=True
if chk:
  print("YES")
else:
  print("NO")
0