結果

問題 No.707 書道
ユーザー cielciel
提出日時 2018-07-08 00:16:20
言語 Ruby
(3.3.0)
結果
AC  
実行時間 259 ms / 2,000 ms
コード長 235 bytes
コンパイル時間 839 ms
コンパイル使用メモリ 11,340 KB
実行使用メモリ 15,480 KB
最終ジャッジ日時 2023-09-19 08:22:53
合計ジャッジ時間 3,569 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
15,044 KB
testcase_01 AC 88 ms
15,300 KB
testcase_02 AC 121 ms
15,480 KB
testcase_03 AC 87 ms
15,244 KB
testcase_04 AC 87 ms
15,248 KB
testcase_05 AC 171 ms
15,256 KB
testcase_06 AC 213 ms
15,392 KB
testcase_07 AC 259 ms
15,392 KB
testcase_08 AC 92 ms
15,476 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

h,w=gets.split.map &:to_i
m=$<.map{|e|e.chomp}
r=Float::INFINITY
(-1..h).each{|y|(-1..w).each{|x|
	next if 0<=y&&y<h && 0<=x&&x<w
	r0=0
	(0...h).each{|i|(0...w).each{|j|
		r0+=Math.hypot(y-i,x-j) if m[i][j]==?1
	}}
	r=[r,r0].min
}}
p r
0