結果

問題 No.179 塗り分け
ユーザー gorugo30
提出日時 2021-03-16 23:13:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 864 bytes
コンパイル時間 467 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 76,928 KB
最終ジャッジ日時 2024-11-08 19:06:27
合計ジャッジ時間 6,282 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 34 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

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

for tatehoukounoshift in range(H):
    for yokohoukounoshift in range(W):
        if tatehoukounoshift == yokohoukounoshift == 0:
            continue
        can = True
        used = [[False] * W for i in range(H)]
        for i in range(H):
            for j in range(W):
                if used[i][j] or grid[i][j] == ".":
                    continue
                if not (0 <= i + tatehoukounoshift < H and 0 <= j + yokohoukounoshift < W):
                    can = False
                    break
                if grid[i + tatehoukounoshift][j + yokohoukounoshift] == ".":
                    can = False
                used[i][j] = True
                used[i + tatehoukounoshift][j + yokohoukounoshift] = True
        if can:
            print("YES")
            exit()
print("NO")
0