結果

問題 No.402 最も海から遠い場所
ユーザー tktk_snsn
提出日時 2020-12-13 01:54:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 436 ms / 3,000 ms
コード長 495 bytes
コンパイル時間 192 ms
コンパイル使用メモリ 82,140 KB
実行使用メモリ 147,756 KB
最終ジャッジ日時 2024-09-19 22:41:28
合計ジャッジ時間 4,173 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


H, W = map(int, input().split())
G = [[0] * (W + 1) for _ in range(H + 1)]
for i in range(1, H + 1):
    for j, v in enumerate(input().rstrip(), 1):
        if v == "#":
            G[i][j] = -1

for i in range(1, H + 1):
    for j in range(1, W + 1):
        if G[i][j] == -1:
            G[i][j] = min(G[i-1][j], G[i][j-1], G[i-1][j-1]) + 1

ans = max(max(g) for g in G)
print((ans + 1) // 2)
0