結果

問題 No.179 塗り分け
ユーザー ntudantuda
提出日時 2023-12-31 18:49:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,218 ms / 3,000 ms
コード長 927 bytes
コンパイル時間 370 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 84,048 KB
最終ジャッジ日時 2023-12-31 18:49:55
合計ジャッジ時間 23,809 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
55,616 KB
testcase_01 AC 41 ms
55,616 KB
testcase_02 AC 56 ms
64,328 KB
testcase_03 AC 42 ms
55,616 KB
testcase_04 AC 54 ms
64,056 KB
testcase_05 AC 205 ms
77,240 KB
testcase_06 AC 96 ms
76,584 KB
testcase_07 AC 50 ms
55,608 KB
testcase_08 AC 1,109 ms
81,256 KB
testcase_09 AC 1,104 ms
81,148 KB
testcase_10 AC 558 ms
79,592 KB
testcase_11 AC 472 ms
78,568 KB
testcase_12 AC 925 ms
80,616 KB
testcase_13 AC 62 ms
68,584 KB
testcase_14 AC 62 ms
72,572 KB
testcase_15 AC 43 ms
53,460 KB
testcase_16 AC 39 ms
53,460 KB
testcase_17 AC 39 ms
53,460 KB
testcase_18 AC 598 ms
79,464 KB
testcase_19 AC 563 ms
80,976 KB
testcase_20 AC 1,043 ms
82,664 KB
testcase_21 AC 1,159 ms
82,940 KB
testcase_22 AC 1,218 ms
82,564 KB
testcase_23 AC 576 ms
78,568 KB
testcase_24 AC 1,139 ms
81,404 KB
testcase_25 AC 606 ms
78,716 KB
testcase_26 AC 664 ms
79,720 KB
testcase_27 AC 1,132 ms
81,640 KB
testcase_28 AC 619 ms
79,336 KB
testcase_29 AC 1,159 ms
84,048 KB
testcase_30 AC 821 ms
81,048 KB
testcase_31 AC 1,113 ms
81,896 KB
testcase_32 AC 727 ms
80,616 KB
testcase_33 AC 1,119 ms
82,408 KB
testcase_34 AC 665 ms
80,488 KB
testcase_35 AC 1,102 ms
83,176 KB
testcase_36 AC 40 ms
55,616 KB
testcase_37 AC 42 ms
55,616 KB
testcase_38 AC 41 ms
55,616 KB
testcase_39 AC 46 ms
55,616 KB
testcase_40 AC 47 ms
61,928 KB
testcase_41 AC 47 ms
55,616 KB
testcase_42 AC 46 ms
61,928 KB
testcase_43 AC 98 ms
76,592 KB
testcase_44 AC 214 ms
77,424 KB
testcase_45 AC 92 ms
77,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from copy import deepcopy

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

tmp = 0
for s in S:
    tmp += s.count("#")
if tmp == 0:
    print("NO")
    exit()

for i in range(-H+1,H):
    for j in range(-W+1,W):
        if i == 0 and j == 0:
            continue
        T = deepcopy(S)
        f = True
        for h in range(H):
            for w in range(W):
                if T[h][w] == "#":
                    T[h][w] == "."
                    if 0 <= i + h < H and 0 <= j + w < W:
                        if T[i + h][j + w] == "#":
                            T[i + h][j + w] = "."
                        else:
                            f = False
                    else:
                        f = False
                if f == False:
                    break
            if f == False:
                break
        if f == True:
            print("YES")
            exit()
print("NO")
0