結果

問題 No.179 塗り分け
ユーザー Ryushi-techRyushi-tech
提出日時 2020-06-24 22:45:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 990 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 87,184 KB
実行使用メモリ 77,644 KB
最終ジャッジ日時 2023-09-16 21:25:17
合計ジャッジ時間 7,764 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,504 KB
testcase_01 AC 66 ms
71,580 KB
testcase_02 AC 63 ms
71,412 KB
testcase_03 WA -
testcase_04 AC 64 ms
71,364 KB
testcase_05 AC 64 ms
71,432 KB
testcase_06 AC 67 ms
71,448 KB
testcase_07 AC 68 ms
75,808 KB
testcase_08 AC 72 ms
76,532 KB
testcase_09 AC 72 ms
76,416 KB
testcase_10 AC 74 ms
76,296 KB
testcase_11 AC 74 ms
76,184 KB
testcase_12 AC 479 ms
77,560 KB
testcase_13 AC 67 ms
71,464 KB
testcase_14 WA -
testcase_15 AC 66 ms
71,100 KB
testcase_16 AC 65 ms
71,296 KB
testcase_17 AC 67 ms
71,364 KB
testcase_18 AC 81 ms
76,312 KB
testcase_19 AC 81 ms
76,300 KB
testcase_20 AC 69 ms
75,964 KB
testcase_21 AC 68 ms
75,696 KB
testcase_22 AC 119 ms
77,216 KB
testcase_23 AC 70 ms
76,140 KB
testcase_24 AC 122 ms
77,396 KB
testcase_25 AC 72 ms
76,052 KB
testcase_26 AC 164 ms
77,312 KB
testcase_27 AC 218 ms
77,476 KB
testcase_28 AC 295 ms
77,324 KB
testcase_29 AC 296 ms
77,436 KB
testcase_30 AC 280 ms
77,452 KB
testcase_31 WA -
testcase_32 AC 129 ms
76,892 KB
testcase_33 WA -
testcase_34 AC 365 ms
77,448 KB
testcase_35 AC 441 ms
77,460 KB
testcase_36 AC 69 ms
71,140 KB
testcase_37 AC 69 ms
71,360 KB
testcase_38 AC 67 ms
71,424 KB
testcase_39 AC 67 ms
71,408 KB
testcase_40 AC 68 ms
71,360 KB
testcase_41 AC 67 ms
71,360 KB
testcase_42 AC 68 ms
71,268 KB
testcase_43 AC 90 ms
76,444 KB
testcase_44 AC 121 ms
77,092 KB
testcase_45 AC 81 ms
76,152 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):
        tmp = set()
        cnt = 0
        for e in E:
            z = e + x * 1000 + y
            if e in tmp:
                continue
            elif z in D:
                cnt += 1
                tmp.add(z)
        if l // 2 == cnt:
            print("YES")
            exit()
#print("turn2")
for x in range(h - 1, -1, -1):
    for y in range(0, -w, -1):
        tmp = set()
        cnt = 0
        for e in E[::-1]:
            z = e + x * 1000 + y
            if e in tmp:
                continue
            elif z in D:
                cnt += 1
                tmp.add(z)
        if l // 2 == cnt:
            print("YES")
            exit()
print("NO")
0