結果

問題 No.472 平均順位
ユーザー cielciel
提出日時 2016-12-22 01:14:54
言語 Crystal
(1.11.2)
結果
TLE  
実行時間 -
コード長 401 bytes
コンパイル時間 19,261 ms
コンパイル使用メモリ 263,096 KB
実行使用メモリ 199,800 KB
最終ジャッジ日時 2023-09-13 09:25:18
合計ジャッジ時間 27,171 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,632 KB
testcase_01 AC 2 ms
4,468 KB
testcase_02 AC 3 ms
4,472 KB
testcase_03 AC 3 ms
4,568 KB
testcase_04 AC 7 ms
5,876 KB
testcase_05 AC 3 ms
4,640 KB
testcase_06 AC 4 ms
5,100 KB
testcase_07 AC 17 ms
7,976 KB
testcase_08 AC 311 ms
42,120 KB
testcase_09 TLE -
testcase_10 AC 1,553 ms
181,664 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env crystal
def dfs(
	memo : Hash(Array(Int32),Int64),
	v : Array(Array(Int64)),
	d : Int32,
	r : Int32
)
	return 0_i64 if d==v.size
	memo[[d,r]]||=(0..[r,3].min).reduce(1_i64<<60){|s,i|
		[s,dfs(memo,v,d+1,r-i)+v[d][i]].min
	}
end
memo=Hash(Array(Int32),Int64).new
n,k=gets.not_nil!.split.map(&.to_i)
v=n.times.map{gets.not_nil!.split.map(&.to_i64)+[1_i64]}.to_a
p dfs(memo,v,0,k) / n.to_f
0