結果

問題 No.402 最も海から遠い場所
ユーザー 37zigen37zigen
提出日時 2016-07-23 12:00:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 870 ms / 3,000 ms
コード長 747 bytes
コンパイル時間 2,755 ms
コンパイル使用メモリ 73,164 KB
実行使用メモリ 183,988 KB
最終ジャッジ日時 2023-08-06 11:44:31
合計ジャッジ時間 11,146 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,656 KB
testcase_01 AC 124 ms
55,924 KB
testcase_02 AC 132 ms
55,616 KB
testcase_03 AC 122 ms
55,960 KB
testcase_04 AC 122 ms
55,448 KB
testcase_05 AC 125 ms
55,596 KB
testcase_06 AC 124 ms
56,172 KB
testcase_07 AC 125 ms
55,620 KB
testcase_08 AC 122 ms
55,564 KB
testcase_09 AC 124 ms
55,676 KB
testcase_10 AC 127 ms
56,212 KB
testcase_11 AC 126 ms
55,848 KB
testcase_12 AC 124 ms
55,852 KB
testcase_13 AC 167 ms
56,548 KB
testcase_14 AC 156 ms
56,676 KB
testcase_15 AC 241 ms
61,220 KB
testcase_16 AC 302 ms
61,616 KB
testcase_17 AC 602 ms
112,352 KB
testcase_18 AC 870 ms
183,412 KB
testcase_19 AC 811 ms
183,696 KB
testcase_20 AC 842 ms
183,988 KB
testcase_21 AC 830 ms
183,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		solver();
	}

	static void solver() {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		char[][] table = new char[H][W];
		dis = new int[H][W];

		for (int i = 0; i < H; i++) {
			table[i] = sc.next().toCharArray();
		}

		int[][] dp = new int[H + 2][W + 2];

		int ans = 0;
		for (int i = 1; i <= H; i++) {
			for (int j = 1; j <= W; j++) {
				if (table[i-1][j-1] == '.')
					continue;
				dp[i][j] = Math.min(dp[i - 1][j - 1] + 1, dp[i - 1][j] + 1);
				dp[i][j] = Math.min(dp[i][j], dp[i][j - 1] + 1);

				ans = Math.max(ans, dp[i][j]);
			}
		}
		System.out.println((ans + 1) / 2);

	}

	static int[][] dis;
}
0