結果

問題 No.3063 幅優先探索
ユーザー ks2mks2m
提出日時 2020-04-01 22:22:23
言語 Java21
(openjdk 21)
結果
AC  
実行時間 141 ms / 2,000 ms
コード長 737 bytes
コンパイル時間 4,023 ms
コンパイル使用メモリ 70,748 KB
実行使用メモリ 42,076 KB
最終ジャッジ日時 2023-09-09 18:56:15
合計ジャッジ時間 5,342 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
33,312 KB
testcase_01 AC 36 ms
33,360 KB
testcase_02 AC 36 ms
33,316 KB
testcase_03 AC 36 ms
33,272 KB
testcase_04 AC 35 ms
33,380 KB
testcase_05 AC 37 ms
33,368 KB
testcase_06 AC 141 ms
42,076 KB
testcase_07 AC 141 ms
42,028 KB
testcase_08 AC 36 ms
33,368 KB
testcase_09 AC 36 ms
33,284 KB
testcase_10 AC 36 ms
33,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int r = Integer.parseInt(sa[0]);
		int c = Integer.parseInt(sa[1]);
		sa = br.readLine().split(" ");
		int sy = Integer.parseInt(sa[0]);
		int sx = Integer.parseInt(sa[1]);
		sa = br.readLine().split(" ");
		int gy = Integer.parseInt(sa[0]);
		int gx = Integer.parseInt(sa[1]);
		char[][] a = new char[r][c];
		for (int i = 0; i < a.length; i++) {
			a[i] = br.readLine().toCharArray();
		}
		br.close();

		System.out.println(Math.abs(gy - sy) + Math.abs(gx - sx));
	}
}
0