結果

問題 No.472 平均順位
ユーザー cielciel
提出日時 2020-08-14 22:35:46
言語 Crystal
(1.11.2)
結果
TLE  
実行時間 -
コード長 321 bytes
コンパイル時間 20,874 ms
コンパイル使用メモリ 260,580 KB
実行使用メモリ 224,748 KB
最終ジャッジ日時 2023-09-13 11:52:00
合計ジャッジ時間 26,797 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,460 KB
testcase_01 AC 3 ms
4,396 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 4 ms
4,984 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 3 ms
4,696 KB
testcase_07 AC 8 ms
5,876 KB
testcase_08 AC 85 ms
18,780 KB
testcase_09 AC 549 ms
73,248 KB
testcase_10 AC 424 ms
75,040 KB
testcase_11 TLE -
testcase_12 AC 1,610 ms
143,864 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def dfs(
	v : Array(Array(Int32)),
	d : Int32,
	r : Int32
) : Int32
	return 0_i32 if d==v.size
	Memo[{d,r}]||=(0..[r,3].min).map{|i|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