結果

問題 No.179 塗り分け
ユーザー AT274_AT274_
提出日時 2019-10-23 21:31:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 611 ms / 3,000 ms
コード長 950 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 87,340 KB
実行使用メモリ 79,840 KB
最終ジャッジ日時 2023-09-30 21:14:41
合計ジャッジ時間 13,485 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,304 KB
testcase_01 AC 76 ms
71,248 KB
testcase_02 AC 78 ms
75,152 KB
testcase_03 AC 74 ms
71,488 KB
testcase_04 AC 80 ms
75,588 KB
testcase_05 AC 168 ms
77,816 KB
testcase_06 AC 107 ms
77,236 KB
testcase_07 AC 74 ms
71,256 KB
testcase_08 AC 384 ms
78,604 KB
testcase_09 AC 407 ms
78,992 KB
testcase_10 AC 243 ms
77,728 KB
testcase_11 AC 219 ms
77,568 KB
testcase_12 AC 367 ms
78,804 KB
testcase_13 AC 83 ms
75,496 KB
testcase_14 AC 87 ms
76,512 KB
testcase_15 AC 75 ms
71,520 KB
testcase_16 AC 75 ms
71,208 KB
testcase_17 AC 74 ms
71,264 KB
testcase_18 AC 303 ms
78,224 KB
testcase_19 AC 298 ms
78,268 KB
testcase_20 AC 498 ms
79,144 KB
testcase_21 AC 448 ms
79,432 KB
testcase_22 AC 611 ms
79,200 KB
testcase_23 AC 312 ms
78,012 KB
testcase_24 AC 418 ms
78,620 KB
testcase_25 AC 269 ms
77,944 KB
testcase_26 AC 335 ms
78,360 KB
testcase_27 AC 515 ms
79,140 KB
testcase_28 AC 343 ms
78,116 KB
testcase_29 AC 593 ms
79,648 KB
testcase_30 AC 434 ms
79,372 KB
testcase_31 AC 566 ms
79,548 KB
testcase_32 AC 393 ms
79,000 KB
testcase_33 AC 569 ms
79,676 KB
testcase_34 AC 387 ms
78,496 KB
testcase_35 AC 542 ms
79,840 KB
testcase_36 AC 73 ms
71,260 KB
testcase_37 AC 74 ms
71,280 KB
testcase_38 AC 74 ms
71,288 KB
testcase_39 AC 72 ms
71,492 KB
testcase_40 AC 80 ms
75,596 KB
testcase_41 AC 74 ms
71,040 KB
testcase_42 AC 77 ms
75,732 KB
testcase_43 AC 127 ms
77,328 KB
testcase_44 AC 179 ms
78,008 KB
testcase_45 AC 94 ms
76,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

black = 0
for g in G:
    black += g.count('#')
if black == 0:
    print('NO')
    exit()


break_flg = False
for d in range(-H + 1, H):
    for r in range(-W + 1, W):

        if (d == 0) and (r == 0):
            continue

        T = [[0 if G[i][j] == '#' else -1 for j in range(W)] for i in range(H)]
        for i in range(H):
            for j in range(W):
                if T[i][j] == 0:
                    if not ((0 <= i + d < H) and (0 <= j + r < W)):
                        break_flg = True
                        break

                    if T[i + d][j + r] == 0:
                        T[i + d][j + r] += 1
                    else:
                        break_flg = True
                        break

            if break_flg:
                break_flg = False
                break

        else:
            print('YES')
            exit()

print('NO')
0