結果

問題 No.472 平均順位
ユーザー cielciel
提出日時 2020-08-14 22:42:19
言語 Crystal
(1.11.2)
結果
MLE  
実行時間 -
コード長 361 bytes
コンパイル時間 17,093 ms
コンパイル使用メモリ 261,256 KB
実行使用メモリ 307,900 KB
最終ジャッジ日時 2023-09-13 11:53:09
合計ジャッジ時間 22,377 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,496 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 5 ms
5,080 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 3 ms
4,736 KB
testcase_07 AC 10 ms
5,608 KB
testcase_08 AC 102 ms
15,948 KB
testcase_09 AC 676 ms
85,672 KB
testcase_10 AC 545 ms
88,116 KB
testcase_11 MLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env crystal
def dfs(
	v : Array(Array(Int32)),
	d : Int32,
	r : Int32
) : Int32
	return 0_i32 if d==v.size
	Memo[d*20000+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(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