結果

問題 No.402 最も海から遠い場所
ユーザー sekiya9311sekiya9311
提出日時 2016-08-28 13:36:44
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 792 bytes
コンパイル時間 3,440 ms
コンパイル使用メモリ 78,232 KB
実行使用メモリ 98,696 KB
最終ジャッジ日時 2024-04-26 16:55:33
合計ジャッジ時間 11,981 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
41,484 KB
testcase_01 WA -
testcase_02 AC 134 ms
41,280 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 127 ms
41,236 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 711 ms
98,672 KB
testcase_20 WA -
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Yuki402 {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int H, W;
		H = sc.nextInt();
		W = sc.nextInt();
		sc.nextLine();
		int[][] dp = new int[H][W];
		int ans = 0;
		for (int i = 0; i < H; i++) {
			String s = sc.nextLine();
			for (int j = 0; j < W; j++) {
				if (s.charAt(j) == '.') {
					dp[i][j] = 0;
				} else {
					dp[i][j] = (int) 1e9;
					if (i - 1 >= 0)
						dp[i][j] = Math.min(dp[i][j], dp[i - 1][j]);
					if (j - 1 >= 0)
						dp[i][j] = Math.min(dp[i][j], dp[i][j - 1]);
					if (i - 1 >= 0 && j - 1 >= 0)
						dp[i][j] = Math.min(dp[i][j], dp[i - 1][j - 1]);
					dp[i][j]++;
					ans = Math.max(ans, dp[i][j]);
				}
			}
		}
		ans = (ans + 1) / 2;
		System.out.println(ans);
	}
}
0