結果

問題 No.402 最も海から遠い場所
ユーザー lloyzlloyz
提出日時 2023-01-26 20:21:19
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 446 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 86,668 KB
実行使用メモリ 435,112 KB
最終ジャッジ日時 2023-09-09 19:14:02
合計ジャッジ時間 8,624 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,544 KB
testcase_01 AC 72 ms
71,480 KB
testcase_02 AC 81 ms
76,512 KB
testcase_03 AC 71 ms
71,368 KB
testcase_04 AC 71 ms
71,236 KB
testcase_05 AC 71 ms
71,220 KB
testcase_06 AC 72 ms
71,476 KB
testcase_07 AC 71 ms
71,216 KB
testcase_08 AC 71 ms
71,384 KB
testcase_09 AC 71 ms
71,312 KB
testcase_10 AC 71 ms
71,360 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 106 ms
77,816 KB
testcase_15 AC 136 ms
86,456 KB
testcase_16 AC 146 ms
90,696 KB
testcase_17 RE -
testcase_18 AC 1,164 ms
435,112 KB
testcase_19 AC 1,034 ms
432,900 KB
testcase_20 AC 1,014 ms
434,596 KB
testcase_21 AC 1,006 ms
433,596 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(h)]
    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