結果

問題 No.179 塗り分け
ユーザー Ryushi-tech
提出日時 2020-06-24 20:43:17
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 623 bytes
コンパイル時間 943 ms
コンパイル使用メモリ 82,244 KB
実行使用メモリ 82,704 KB
最終ジャッジ日時 2024-07-03 20:20:46
合計ジャッジ時間 5,620 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 5 WA * 1 TLE * 1 -- * 33
権限があれば一括ダウンロードができます

ソースコード

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(1, w):
        tmp = []
        cnt = 0
        for e in E:
            z = e + x * 1000 + y
            if e in tmp:
                continue
            elif z in E:
                cnt += 1
                tmp.append(z)
        if l // 2 == cnt:
            print("YES")
            exit()
print("NO")
0