結果

問題 No.179 塗り分け
ユーザー yuuki1036
提出日時 2018-11-07 23:03:11
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 824 bytes
コンパイル時間 104 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 19,840 KB
最終ジャッジ日時 2024-11-20 20:54:01
合計ジャッジ時間 4,346 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5 WA * 1
other AC * 25 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter

H, W = map(int,input().split())
M = [input() for i in range(H)]

drct = [(0,1), (1,1), (1,0)]
cnt = 0
common = []

for y in range(H):
    for x in range(W):
        if M[y][x] == '.':
            continue
        cnt += 1
        for i,d in enumerate(drct):
            dy = y
            dx = x
            for j in range(W):
                dy += d[0]
                dx += d[1]
                if dy<=H-1 and dx<=W-1:
                    if M[dy][dx] == '#':
                        f = str(i) + str(j)
                        common.append(f)
                else:
                    break
                
if cnt == 0 or cnt % 2:
    print('NO')
    exit()

C = Counter(common).most_common()

for i in C:
    if i[1] == cnt//2:
        print('YES')
        break
else:
    print('NO')
0