結果

問題 No.179 塗り分け
ユーザー Ryushi-techRyushi-tech
提出日時 2020-06-24 23:06:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,035 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 86,952 KB
実行使用メモリ 77,732 KB
最終ジャッジ日時 2023-09-16 21:25:41
合計ジャッジ時間 7,448 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
71,356 KB
testcase_01 AC 63 ms
71,208 KB
testcase_02 AC 64 ms
71,228 KB
testcase_03 WA -
testcase_04 AC 64 ms
71,108 KB
testcase_05 AC 68 ms
71,204 KB
testcase_06 AC 68 ms
71,216 KB
testcase_07 AC 67 ms
75,780 KB
testcase_08 AC 74 ms
76,028 KB
testcase_09 AC 78 ms
76,376 KB
testcase_10 AC 74 ms
75,992 KB
testcase_11 AC 73 ms
75,880 KB
testcase_12 AC 517 ms
77,732 KB
testcase_13 AC 67 ms
71,272 KB
testcase_14 WA -
testcase_15 AC 66 ms
71,408 KB
testcase_16 AC 68 ms
71,428 KB
testcase_17 AC 67 ms
71,112 KB
testcase_18 AC 82 ms
76,248 KB
testcase_19 AC 82 ms
76,116 KB
testcase_20 AC 70 ms
75,956 KB
testcase_21 AC 71 ms
75,756 KB
testcase_22 AC 130 ms
77,144 KB
testcase_23 AC 74 ms
75,840 KB
testcase_24 AC 136 ms
77,420 KB
testcase_25 AC 77 ms
76,332 KB
testcase_26 AC 146 ms
77,032 KB
testcase_27 AC 233 ms
77,292 KB
testcase_28 AC 213 ms
77,004 KB
testcase_29 AC 317 ms
77,624 KB
testcase_30 AC 247 ms
77,472 KB
testcase_31 WA -
testcase_32 AC 126 ms
77,052 KB
testcase_33 WA -
testcase_34 AC 295 ms
77,532 KB
testcase_35 AC 449 ms
77,448 KB
testcase_36 AC 66 ms
71,360 KB
testcase_37 AC 64 ms
71,316 KB
testcase_38 AC 63 ms
71,236 KB
testcase_39 AC 64 ms
71,228 KB
testcase_40 AC 65 ms
71,040 KB
testcase_41 AC 64 ms
70,964 KB
testcase_42 AC 64 ms
71,408 KB
testcase_43 AC 86 ms
76,316 KB
testcase_44 AC 115 ms
77,116 KB
testcase_45 AC 76 ms
76,136 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):
    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:
                #print(e,z)
                cnt += 1
                tmp.add(z)
        if l // 2 == cnt:
            #print(cnt, tmp)
            print("YES")
            exit()
print("NO")
0