結果

問題 No.402 最も海から遠い場所
ユーザー AreTrashAreTrash
提出日時 2016-07-21 03:38:54
言語 Java21
(openjdk 21)
結果
AC  
実行時間 813 ms / 3,000 ms
コード長 533 bytes
コンパイル時間 1,892 ms
コンパイル使用メモリ 74,488 KB
実行使用メモリ 106,188 KB
最終ジャッジ日時 2024-04-24 03:23:10
合計ジャッジ時間 9,200 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
40,264 KB
testcase_01 AC 116 ms
41,252 KB
testcase_02 AC 125 ms
41,544 KB
testcase_03 AC 119 ms
41,624 KB
testcase_04 AC 112 ms
41,556 KB
testcase_05 AC 119 ms
41,376 KB
testcase_06 AC 124 ms
41,736 KB
testcase_07 AC 121 ms
41,668 KB
testcase_08 AC 104 ms
40,632 KB
testcase_09 AC 117 ms
41,436 KB
testcase_10 AC 120 ms
41,440 KB
testcase_11 AC 125 ms
41,240 KB
testcase_12 AC 112 ms
40,352 KB
testcase_13 AC 164 ms
41,948 KB
testcase_14 AC 152 ms
41,888 KB
testcase_15 AC 220 ms
44,704 KB
testcase_16 AC 264 ms
45,240 KB
testcase_17 AC 546 ms
67,676 KB
testcase_18 AC 813 ms
106,052 KB
testcase_19 AC 769 ms
106,188 KB
testcase_20 AC 796 ms
106,148 KB
testcase_21 AC 750 ms
105,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Yuki2_2{	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int H = sc.nextInt();
		int W = sc.nextInt();
		int dp[][] = new int[H + 2][W + 2];
		int res = 0;
		
		for(int i = 1; i <= H; i++){
		String input = sc.next();
			for(int j = 1; j <= W; j++){
				if(input.charAt(j - 1) == '#'){
					dp[i][j] = Math.min(dp[i - 1][j - 1], Math.min(dp[i - 1][j], dp[i][j - 1])) + 1;
					res = Math.max(res, dp[i][j]);
				}
			}
		}
		System.out.println((res + 1) / 2);
	}
}
0