結果

問題 No.472 平均順位
ユーザー cielciel
提出日時 2020-08-14 22:32:52
言語 Crystal
(1.11.2)
結果
TLE  
実行時間 -
コード長 338 bytes
コンパイル時間 17,398 ms
コンパイル使用メモリ 262,028 KB
実行使用メモリ 227,044 KB
最終ジャッジ日時 2023-09-13 11:53:34
合計ジャッジ時間 22,743 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,448 KB
testcase_01 AC 3 ms
4,504 KB
testcase_02 AC 2 ms
4,424 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 5 ms
4,988 KB
testcase_05 AC 2 ms
4,508 KB
testcase_06 AC 4 ms
4,860 KB
testcase_07 AC 10 ms
5,960 KB
testcase_08 AC 107 ms
17,216 KB
testcase_09 AC 682 ms
77,812 KB
testcase_10 AC 537 ms
63,452 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def dfs(
	v : Array(Array(Int32)),
	d : Int32,
	r : Int32
)
	return 0_i32 if d==v.size
	Memo[{d,r}]||=(0..[r,3].min).reduce(1_i32<<30){|s,i|
		[s,dfs(v,d+1,r-i)+v[d][i]].min
	}
end
Memo=Hash(Tuple(Int32,Int32),Int32).new
n,k=gets.not_nil!.split.map(&.to_i)
v=(0...n).map{gets.not_nil!.split.map(&.to_i)+[1_i32]}.to_a
p dfs(v,0,k) / n.to_f
0