結果

問題 No.179 塗り分け
ユーザー FromBooska
提出日時 2024-02-23 18:42:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 819 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 82,236 KB
実行使用メモリ 83,612 KB
最終ジャッジ日時 2024-09-29 05:13:57
合計ジャッジ時間 14,517 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 34 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

H, W = map(int, input().split())
S = []
dots = []
for i in range(H):
    temp = list(input())
    S.append(temp)
    for j in range(W):
        if temp[j] == '#':
            dots.append((i, j))

#print(S)
#print(dots)

dots_set = set(dots)
ans = 'NO'

for di in range(0, H):
    for dj in range(0, W):
        if di==0 and dj==0:
            continue
        covered = set()
        test = True
        for i, j in dots:
            if (i, j) in covered:
                continue
            #print('i', i, 'j', j, (i+di, j+dj) in dots_set, test)
            if (i+di, j+dj) in dots_set:
                covered.add((i+di, j+dj))
            else:
                test = False
            covered.add((i, j))
        #print('di', di, 'dj', dj, covered, test)
        if test == True:
            ans = 'YES'
print(ans)
0