結果

問題 No.179 塗り分け
コンテスト
ユーザー AEn
提出日時 2022-05-13 13:14:30
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 862 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 267 ms
コンパイル使用メモリ 84,952 KB
実行使用メモリ 81,240 KB
最終ジャッジ日時 2026-04-03 04:31:15
合計ジャッジ時間 3,971 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 34 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

H, W = map(int, input().split())
c = []
for _ in range(H):
    c.append(list(input()))
for i in range(H):
    for j in range(W):
        if i == j == 0:
            continue
        b = set()
        f = False
        for x in range(H):
            for y in range(W):
                if x+i>H-1 or y+j>W-1:
                    if (x, y) not in b and c[x][y] == '#':
                        f = True
                        break
                    else:
                        continue
                if c[x][y]=='.' or (x, y) in b:
                    continue
                b.add((x, y))
                if c[x+i][y+j] == '.':
                    f = True
                    break
                else:
                    b.add((x+i, y+j))
            if f:
                break
        if not f:
            print('YES')
            exit()
print('NO')
0