結果

問題 No.402 最も海から遠い場所
ユーザー H3PO4H3PO4
提出日時 2020-07-20 17:25:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 366 ms / 3,000 ms
コード長 447 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 86,968 KB
実行使用メモリ 149,004 KB
最終ジャッジ日時 2023-08-25 18:15:22
合計ジャッジ時間 4,349 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,316 KB
testcase_01 AC 64 ms
71,124 KB
testcase_02 AC 69 ms
76,288 KB
testcase_03 AC 62 ms
71,348 KB
testcase_04 AC 66 ms
71,268 KB
testcase_05 AC 65 ms
71,108 KB
testcase_06 AC 62 ms
71,064 KB
testcase_07 AC 61 ms
71,368 KB
testcase_08 AC 62 ms
71,264 KB
testcase_09 AC 63 ms
71,084 KB
testcase_10 AC 69 ms
71,528 KB
testcase_11 AC 72 ms
76,460 KB
testcase_12 AC 63 ms
71,116 KB
testcase_13 AC 79 ms
76,152 KB
testcase_14 AC 78 ms
76,520 KB
testcase_15 AC 86 ms
76,260 KB
testcase_16 AC 94 ms
76,596 KB
testcase_17 AC 251 ms
106,764 KB
testcase_18 AC 366 ms
148,780 KB
testcase_19 AC 217 ms
148,684 KB
testcase_20 AC 349 ms
148,792 KB
testcase_21 AC 295 ms
149,004 KB
権限があれば一括ダウンロードができます

ソースコード

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