結果

問題 No.707 書道
ユーザー 👑 tatt61880tatt61880
提出日時 2020-04-16 02:30:03
言語 Kuin
(KuinC++ v.2021.9.17)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 792 bytes
コンパイル時間 3,348 ms
コンパイル使用メモリ 173,964 KB
実行使用メモリ 4,360 KB
最終ジャッジ日時 2023-10-14 16:09:28
合計ジャッジ時間 3,921 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 3 ms
4,352 KB
testcase_03 AC 2 ms
4,356 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 6 ms
4,348 KB
testcase_06 AC 8 ms
4,360 KB
testcase_07 AC 9 ms
4,352 KB
testcase_08 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

func main()
	var ss: [][]char :: cui@input().split(" ")
	var h: int :: ss[0].toInt(&)
	var w: int :: ss[1].toInt(&)
	var p: [][]char :: #[h, w]char
	for i(0, h - 1)
		do p[i] :: cui@input()
	end for
	var ans: float :: 100000000.0
	var num: int :: 2 * h + 2 * w
	var posX: []int :: #[0]int
	var posY: []int :: #[0]int
	for x(0, w - 1)
		do posX :~ [x, x]
		do posY :~ [-1, h]
	end for
	for y(0, h - 1)
		do posX :~ [-1, w]
		do posY :~ [y, y]
	end for
	for i(0, num - 1)
		var mx: float :: posX[i] $ float
		var my: float :: posY[i] $ float
		var t: float :: 0.0
		for y(0, h - 1)
			for x(0, w - 1)
				if(p[y][x] = '1')
					do t :+ lib@dist(mx, my, x $ float, y $ float)
				end if
			end for
		end for
		do ans :: [ans, t].min()
	end for
	do cui@print("\{ans.toStrFmt(".8f")}\n")
end func
0