結果

問題 No.402 最も海から遠い場所
ユーザー H3PO4H3PO4
提出日時 2020-07-20 17:25:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 447 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 10,896 KB
実行使用メモリ 92,508 KB
最終ジャッジ日時 2023-08-25 18:15:07
合計ジャッジ時間 9,801 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,920 KB
testcase_01 AC 15 ms
7,924 KB
testcase_02 AC 16 ms
7,876 KB
testcase_03 AC 14 ms
7,812 KB
testcase_04 AC 14 ms
7,800 KB
testcase_05 AC 15 ms
7,908 KB
testcase_06 AC 13 ms
7,868 KB
testcase_07 AC 13 ms
7,900 KB
testcase_08 AC 14 ms
7,828 KB
testcase_09 AC 14 ms
7,868 KB
testcase_10 AC 14 ms
7,872 KB
testcase_11 AC 15 ms
7,868 KB
testcase_12 AC 15 ms
7,792 KB
testcase_13 AC 42 ms
8,620 KB
testcase_14 AC 30 ms
8,328 KB
testcase_15 AC 157 ms
10,384 KB
testcase_16 AC 360 ms
11,164 KB
testcase_17 AC 2,787 ms
47,092 KB
testcase_18 TLE -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

dp = [[0] * W for _ in range(H)]
for h in range(H):
    if S[h][0] == '#':
        dp[h][0] = 1
for w in range(1, W):
    if S[0][w] == '#':
        dp[0][w] = 1

M = dp[0][0]
for h in range(1, H):
    for w in range(1, W):
        if S[h][w] == '#':
            dp[h][w] = min(dp[h - 1][w], dp[h][w - 1], dp[h - 1][w - 1]) + 1
            M = max(M, dp[h][w])
print((M + 1) // 2)
0