結果

問題 No.1037 exhausted
ユーザー 👑 obakyanobakyan
提出日時 2020-04-25 14:28:25
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 23 ms / 2,000 ms
コード長 362 bytes
コンパイル時間 142 ms
コンパイル使用メモリ 5,456 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-06 22:30:34
合計ジャッジ時間 1,463 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 23 ms
4,380 KB
testcase_13 AC 23 ms
4,376 KB
testcase_14 AC 22 ms
4,380 KB
testcase_15 AC 23 ms
4,380 KB
testcase_16 AC 22 ms
4,380 KB
testcase_17 AC 23 ms
4,376 KB
testcase_18 AC 23 ms
4,376 KB
testcase_19 AC 23 ms
4,376 KB
testcase_20 AC 21 ms
4,380 KB
testcase_21 AC 22 ms
4,376 KB
testcase_22 AC 20 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mi=math.min
n,v,l=io.read("*n","*n","*n")
f=2^44
d={} for i=0,v do d[i]=0 end
p=0
for i=1,n+1 do
  if n<i then x,z,w=l,0,0 else x,z,w=io.read("*n","*n","*n") end
  y=x-p p=x
  for j=y,v do d[j-y]=d[j] end
  for j=math.max(0,v+1-y),v do d[j]=f end
  for j=v,0,-1 do q=mi(v,j+z) d[q]=mi(d[q],d[j]+w) end
end
r=f
for i=0,v do r=mi(r,d[i]) end
print(r<f and r or -1)
0