結果

問題 No.402 最も海から遠い場所
ユーザー tktk_snsntktk_snsn
提出日時 2020-12-13 01:54:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 538 ms / 3,000 ms
コード長 495 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 81,604 KB
実行使用メモリ 147,224 KB
最終ジャッジ日時 2023-10-20 02:55:22
合計ジャッジ時間 4,612 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
55,428 KB
testcase_01 AC 44 ms
55,428 KB
testcase_02 AC 55 ms
64,088 KB
testcase_03 AC 43 ms
53,380 KB
testcase_04 AC 45 ms
55,428 KB
testcase_05 AC 43 ms
55,428 KB
testcase_06 AC 43 ms
55,428 KB
testcase_07 AC 45 ms
55,428 KB
testcase_08 AC 45 ms
55,428 KB
testcase_09 AC 44 ms
55,428 KB
testcase_10 AC 45 ms
55,428 KB
testcase_11 AC 55 ms
62,056 KB
testcase_12 AC 45 ms
55,428 KB
testcase_13 AC 65 ms
70,284 KB
testcase_14 AC 69 ms
70,680 KB
testcase_15 AC 85 ms
77,844 KB
testcase_16 AC 92 ms
78,692 KB
testcase_17 AC 339 ms
110,468 KB
testcase_18 AC 538 ms
147,224 KB
testcase_19 AC 313 ms
146,940 KB
testcase_20 AC 458 ms
146,916 KB
testcase_21 AC 453 ms
147,180 KB
権限があれば一括ダウンロードができます

ソースコード

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