結果

問題 No.179 塗り分け
ユーザー とりすけとりすけ
提出日時 2023-05-02 01:05:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,045 bytes
コンパイル時間 1,745 ms
コンパイル使用メモリ 86,612 KB
実行使用メモリ 84,064 KB
最終ジャッジ日時 2023-08-13 03:37:14
合計ジャッジ時間 15,554 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
71,480 KB
testcase_01 AC 85 ms
71,520 KB
testcase_02 AC 85 ms
71,216 KB
testcase_03 AC 85 ms
71,612 KB
testcase_04 AC 86 ms
71,320 KB
testcase_05 AC 229 ms
81,440 KB
testcase_06 AC 85 ms
71,652 KB
testcase_07 WA -
testcase_08 AC 394 ms
79,508 KB
testcase_09 AC 624 ms
82,772 KB
testcase_10 AC 95 ms
76,464 KB
testcase_11 AC 93 ms
76,592 KB
testcase_12 AC 537 ms
80,224 KB
testcase_13 AC 102 ms
77,640 KB
testcase_14 AC 104 ms
77,164 KB
testcase_15 WA -
testcase_16 AC 85 ms
71,460 KB
testcase_17 WA -
testcase_18 AC 110 ms
78,164 KB
testcase_19 AC 110 ms
77,936 KB
testcase_20 AC 593 ms
82,480 KB
testcase_21 AC 764 ms
82,336 KB
testcase_22 AC 760 ms
84,064 KB
testcase_23 AC 96 ms
76,356 KB
testcase_24 AC 675 ms
82,092 KB
testcase_25 AC 105 ms
77,880 KB
testcase_26 AC 422 ms
80,552 KB
testcase_27 AC 614 ms
82,188 KB
testcase_28 AC 413 ms
81,280 KB
testcase_29 AC 667 ms
82,732 KB
testcase_30 AC 491 ms
81,308 KB
testcase_31 AC 642 ms
81,480 KB
testcase_32 AC 183 ms
78,668 KB
testcase_33 AC 657 ms
81,392 KB
testcase_34 AC 434 ms
80,328 KB
testcase_35 AC 630 ms
82,776 KB
testcase_36 AC 86 ms
71,464 KB
testcase_37 AC 86 ms
71,452 KB
testcase_38 AC 84 ms
71,568 KB
testcase_39 AC 85 ms
71,492 KB
testcase_40 AC 92 ms
76,380 KB
testcase_41 AC 85 ms
71,568 KB
testcase_42 AC 91 ms
76,236 KB
testcase_43 AC 122 ms
78,140 KB
testcase_44 AC 194 ms
79,192 KB
testcase_45 AC 109 ms
77,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import copy

input = sys.stdin.readline

h, w = map(int, input().split())
s = [list(input().strip()) for i in range(h)]

c = 0
for i in range(h):
 for j in range(w):
  if s[i][j] == '#':
   c += 1

if c <= 1:
 print('NO', end='')

for dy in range(h):
 for dx in range(w):
  if dy == 0 and dx == 0:
   continue
  sc = copy.deepcopy(s)
  flag = True
  for i in range(h):
   for j in range(w):
    if sc[i][j] == '#':
     if i + dy >= h or j + dx >= w or sc[i+dy][j+dx] == '.':
      flag = False
      break
     else:
      sc[i+dy][j+dx] = '.'
   if not flag:
    break
  if flag:
   print('YES', end='')
   exit()

for dy in range(h):
 for dx in range(w):
  if dy == 0 and dx == 0:
   continue
  sc = copy.deepcopy(s)
  flag = True
  for i in range(h):
   for j in range(w):
    if sc[i][w-j-1] == '#':
     if i + dy >= h or j + dx >= w or sc[i+dy][w-j-dx-1] == '.':
      flag = False
      break
     else:
      sc[i+dy][w-j-dx-1] = '.'
   if not flag:
    break
  if flag:
   print('YES', end='')
   exit()
print('NO', end='')
0