結果

問題 No.402 最も海から遠い場所
ユーザー 双六双六
提出日時 2020-09-16 00:37:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,138 ms / 3,000 ms
コード長 689 bytes
コンパイル時間 332 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 504,420 KB
最終ジャッジ日時 2023-09-04 03:11:10
合計ジャッジ時間 9,698 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,348 KB
testcase_01 AC 91 ms
71,756 KB
testcase_02 AC 102 ms
77,208 KB
testcase_03 AC 88 ms
71,580 KB
testcase_04 AC 90 ms
71,504 KB
testcase_05 AC 90 ms
71,424 KB
testcase_06 AC 91 ms
71,580 KB
testcase_07 AC 88 ms
71,428 KB
testcase_08 AC 89 ms
71,668 KB
testcase_09 AC 90 ms
71,576 KB
testcase_10 AC 91 ms
71,372 KB
testcase_11 AC 102 ms
77,600 KB
testcase_12 AC 91 ms
71,572 KB
testcase_13 AC 111 ms
77,448 KB
testcase_14 AC 111 ms
77,652 KB
testcase_15 AC 138 ms
88,232 KB
testcase_16 AC 145 ms
93,492 KB
testcase_17 AC 649 ms
284,816 KB
testcase_18 AC 1,138 ms
504,420 KB
testcase_19 AC 1,011 ms
504,136 KB
testcase_20 AC 1,109 ms
504,144 KB
testcase_21 AC 1,030 ms
504,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# import sys; input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**7)
from collections import defaultdict
mod = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

def main():
	H, W = getlist()
	table = []
	for i in range(H):
		l = list(input())
		table.append(l)

	res = 0
	DP = [[0] * W for i in range(H)]
	for i in range(H):
		for j in range(W):
			if table[i][j] == "#":
				DP[i][j] = 1
				res = 1

	for i in range(1, H):
		for j in range(1, W):
			if DP[i][j] == 1:
				DP[i][j] = min(DP[i - 1][j], DP[i][j - 1], DP[i - 1][j - 1]) + 1
			res = max(res, DP[i][j])

	ans = int(res + 1) // 2
	print(ans)

if __name__ == '__main__':
	main()
0