結果

問題 No.179 塗り分け
ユーザー aqua_tenhouaqua_tenhou
提出日時 2021-06-20 22:31:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 618 ms / 3,000 ms
コード長 797 bytes
コンパイル時間 576 ms
コンパイル使用メモリ 87,248 KB
実行使用メモリ 78,752 KB
最終ジャッジ日時 2023-09-05 01:42:49
合計ジャッジ時間 11,563 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,456 KB
testcase_01 AC 73 ms
71,400 KB
testcase_02 AC 69 ms
71,132 KB
testcase_03 AC 70 ms
71,484 KB
testcase_04 AC 76 ms
75,804 KB
testcase_05 AC 166 ms
78,076 KB
testcase_06 AC 87 ms
76,304 KB
testcase_07 AC 68 ms
71,328 KB
testcase_08 AC 276 ms
78,020 KB
testcase_09 AC 276 ms
78,236 KB
testcase_10 AC 100 ms
77,296 KB
testcase_11 AC 100 ms
77,272 KB
testcase_12 AC 474 ms
78,216 KB
testcase_13 AC 81 ms
76,040 KB
testcase_14 AC 83 ms
76,824 KB
testcase_15 AC 70 ms
71,688 KB
testcase_16 AC 70 ms
71,484 KB
testcase_17 AC 68 ms
71,408 KB
testcase_18 AC 126 ms
77,888 KB
testcase_19 AC 125 ms
77,744 KB
testcase_20 AC 414 ms
78,448 KB
testcase_21 AC 345 ms
78,752 KB
testcase_22 AC 440 ms
78,592 KB
testcase_23 AC 101 ms
77,752 KB
testcase_24 AC 317 ms
78,308 KB
testcase_25 AC 99 ms
77,456 KB
testcase_26 AC 162 ms
77,992 KB
testcase_27 AC 441 ms
78,080 KB
testcase_28 AC 143 ms
77,500 KB
testcase_29 AC 570 ms
78,688 KB
testcase_30 AC 311 ms
78,048 KB
testcase_31 AC 618 ms
78,416 KB
testcase_32 AC 258 ms
77,928 KB
testcase_33 AC 561 ms
78,392 KB
testcase_34 AC 234 ms
77,972 KB
testcase_35 AC 597 ms
78,116 KB
testcase_36 AC 68 ms
71,404 KB
testcase_37 AC 73 ms
71,356 KB
testcase_38 AC 70 ms
71,296 KB
testcase_39 AC 77 ms
76,148 KB
testcase_40 AC 75 ms
76,436 KB
testcase_41 AC 70 ms
71,456 KB
testcase_42 AC 78 ms
76,196 KB
testcase_43 AC 128 ms
77,296 KB
testcase_44 AC 175 ms
77,436 KB
testcase_45 AC 109 ms
77,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

h,w = map(int,input().split())
s = [list(input()) for i in range(h)]
c = 0
for x in s: c += x.count("#")
if c == 0:
    print("NO")
    exit()

for i in range(h+1):
    for j in range(-w, w+1):
        use = [[0 for _ in range(w)] for __ in range(h)]
        if i == j == 0: continue
        flg = True
        for x in range(h):
             for y in range(w):
                 if s[x][y] == "#" and use[x][y] == 0:
                    if 0 <= x+i < h and 0 <= y+j < w and s[x+i][y+j] == "#" and use[x+i][y+j] == 0:
                        use[x][y] = 1
                        use[x+i][y+j] = 1
                    else:
                        flg = False
        cc = 0
        for x in use: cc += x.count(1)
        if flg and c == cc:
            print("YES")
            exit()
print("NO")
0