結果

問題 No.179 塗り分け
ユーザー naesiranaesira
提出日時 2023-11-23 17:49:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 647 ms / 3,000 ms
コード長 513 bytes
コンパイル時間 562 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 83,556 KB
最終ジャッジ日時 2023-11-23 17:49:16
合計ジャッジ時間 12,363 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,588 KB
testcase_01 AC 39 ms
53,588 KB
testcase_02 AC 38 ms
53,588 KB
testcase_03 AC 38 ms
53,588 KB
testcase_04 AC 39 ms
53,588 KB
testcase_05 AC 134 ms
76,040 KB
testcase_06 AC 39 ms
53,588 KB
testcase_07 AC 41 ms
53,460 KB
testcase_08 AC 568 ms
83,156 KB
testcase_09 AC 584 ms
83,156 KB
testcase_10 AC 43 ms
59,848 KB
testcase_11 AC 42 ms
59,848 KB
testcase_12 AC 507 ms
81,780 KB
testcase_13 AC 54 ms
66,136 KB
testcase_14 AC 48 ms
62,124 KB
testcase_15 AC 36 ms
53,588 KB
testcase_16 AC 36 ms
53,588 KB
testcase_17 AC 36 ms
53,460 KB
testcase_18 AC 78 ms
75,748 KB
testcase_19 AC 81 ms
75,888 KB
testcase_20 AC 532 ms
83,556 KB
testcase_21 AC 610 ms
83,044 KB
testcase_22 AC 606 ms
82,808 KB
testcase_23 AC 43 ms
59,720 KB
testcase_24 AC 613 ms
82,916 KB
testcase_25 AC 55 ms
68,440 KB
testcase_26 AC 153 ms
76,780 KB
testcase_27 AC 605 ms
82,928 KB
testcase_28 AC 95 ms
76,140 KB
testcase_29 AC 596 ms
82,808 KB
testcase_30 AC 306 ms
78,324 KB
testcase_31 AC 647 ms
82,548 KB
testcase_32 AC 239 ms
77,560 KB
testcase_33 AC 638 ms
83,064 KB
testcase_34 AC 184 ms
76,916 KB
testcase_35 AC 636 ms
82,420 KB
testcase_36 AC 37 ms
53,588 KB
testcase_37 AC 37 ms
53,588 KB
testcase_38 AC 36 ms
53,588 KB
testcase_39 AC 37 ms
53,588 KB
testcase_40 AC 41 ms
59,720 KB
testcase_41 AC 39 ms
53,588 KB
testcase_42 AC 40 ms
58,836 KB
testcase_43 AC 77 ms
75,908 KB
testcase_44 AC 129 ms
75,912 KB
testcase_45 AC 60 ms
70,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import product

H, W = map(int, input().split())
S = [input() for i in range(H)]

if S == ['.'*W]*H:
  print("NO")
  exit()

for di, dj in product(range(H), range(1-W, W)):
  if di == 0 >= dj: continue
  T = [list(S[i]) for i in range(H)]
  for i, j in product(range(H), range(W)):
    i2, j2 = i + di, j + dj
    if H > i2 >= 0 <= j2 < W \
    and T[i][j] == T[i2][j2] == '#':
      T[i][j] = T[i2][j2] = '!'
  
  if all('#' not in row for row in T):
    print("YES")
    break
else:
  print("NO")
0