結果

問題 No.179 塗り分け
ユーザー Ryushi-techRyushi-tech
提出日時 2020-06-24 23:33:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 121 ms / 3,000 ms
コード長 732 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 77,356 KB
最終ジャッジ日時 2023-09-30 21:28:31
合計ジャッジ時間 5,824 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,292 KB
testcase_01 AC 73 ms
71,248 KB
testcase_02 AC 76 ms
71,292 KB
testcase_03 AC 73 ms
71,464 KB
testcase_04 AC 72 ms
71,520 KB
testcase_05 AC 72 ms
71,360 KB
testcase_06 AC 75 ms
71,192 KB
testcase_07 AC 77 ms
75,724 KB
testcase_08 AC 86 ms
76,204 KB
testcase_09 AC 83 ms
76,568 KB
testcase_10 AC 85 ms
76,524 KB
testcase_11 AC 80 ms
76,316 KB
testcase_12 AC 108 ms
77,000 KB
testcase_13 AC 73 ms
71,400 KB
testcase_14 AC 74 ms
71,052 KB
testcase_15 AC 73 ms
71,396 KB
testcase_16 AC 77 ms
71,368 KB
testcase_17 AC 72 ms
71,320 KB
testcase_18 AC 88 ms
76,496 KB
testcase_19 AC 87 ms
76,352 KB
testcase_20 AC 79 ms
76,036 KB
testcase_21 AC 78 ms
75,640 KB
testcase_22 AC 104 ms
76,608 KB
testcase_23 AC 83 ms
76,080 KB
testcase_24 AC 106 ms
76,640 KB
testcase_25 AC 84 ms
76,320 KB
testcase_26 AC 91 ms
76,516 KB
testcase_27 AC 116 ms
77,112 KB
testcase_28 AC 92 ms
76,364 KB
testcase_29 AC 120 ms
77,252 KB
testcase_30 AC 109 ms
77,216 KB
testcase_31 AC 107 ms
77,356 KB
testcase_32 AC 103 ms
77,060 KB
testcase_33 AC 121 ms
77,216 KB
testcase_34 AC 97 ms
76,588 KB
testcase_35 AC 112 ms
77,292 KB
testcase_36 AC 72 ms
71,452 KB
testcase_37 AC 74 ms
71,368 KB
testcase_38 AC 74 ms
71,048 KB
testcase_39 AC 73 ms
71,260 KB
testcase_40 AC 73 ms
71,260 KB
testcase_41 AC 73 ms
71,216 KB
testcase_42 AC 72 ms
71,372 KB
testcase_43 AC 83 ms
76,512 KB
testcase_44 AC 89 ms
76,332 KB
testcase_45 AC 80 ms
76,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

h, w = map(int, input().split())
S = []
for i in range(h):
    S.append(input())

cnt = 0
D = set()
for i in range(h):
    for j in range(w):
        if S[i][j] == "#":
            D.add(i * 1000 + j)

l = len(D)
if l & 1 or not D:
    print("NO")
    exit()
E = sorted(list(D))

for x in range(h):
    for y in range(-w, w):
        tmp = set()
        cnt = 0
        for e in E:
            z = e + x * 1000 + y
            c, d = divmod(z, 1000)
            if e in tmp:
                continue
            elif c < 0 or c > h or d < 0 or d > w:
                break
            elif z in D:
                cnt += 1
                tmp.add(z)
        if l // 2 == cnt:
            print("YES")
            exit()
print("NO")
0