結果

問題 No.402 最も海から遠い場所
ユーザー lloyzlloyz
提出日時 2023-01-26 20:22:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,039 ms / 3,000 ms
コード長 446 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 86,768 KB
実行使用メモリ 434,828 KB
最終ジャッジ日時 2023-09-09 19:14:34
合計ジャッジ時間 7,836 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
70,864 KB
testcase_01 AC 71 ms
71,212 KB
testcase_02 AC 81 ms
76,208 KB
testcase_03 AC 70 ms
71,324 KB
testcase_04 AC 70 ms
71,228 KB
testcase_05 AC 71 ms
71,368 KB
testcase_06 AC 69 ms
71,124 KB
testcase_07 AC 70 ms
71,232 KB
testcase_08 AC 71 ms
71,132 KB
testcase_09 AC 70 ms
71,212 KB
testcase_10 AC 70 ms
71,072 KB
testcase_11 AC 80 ms
76,316 KB
testcase_12 AC 71 ms
71,216 KB
testcase_13 AC 108 ms
78,840 KB
testcase_14 AC 99 ms
76,216 KB
testcase_15 AC 133 ms
86,276 KB
testcase_16 AC 145 ms
90,472 KB
testcase_17 AC 604 ms
249,776 KB
testcase_18 AC 1,039 ms
434,828 KB
testcase_19 AC 897 ms
432,760 KB
testcase_20 AC 1,012 ms
434,788 KB
testcase_21 AC 1,004 ms
433,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

h, w = map(int, input().split())
S = [list(input()) for _ in range(h)]

ans = 1
DP = [0 for _ in range(w)]
for i in range(w):
    DP[i] = S[0][i] == '#'
for i in range(h - 1):
    NDP = [0 for _ in range(w)]
    for j in range(w):
        NDP[j] = S[i + 1][j] == '#'
    for j in range(1, w):
        if NDP[j] == 1:
            NDP[j] = min(NDP[j - 1], DP[j], DP[j - 1]) + 1
            ans = max(ans, NDP[j])
    DP = NDP
print((ans + 1) // 2)
0