結果

問題 No.1037 exhausted
ユーザー 👑 obakyanobakyan
提出日時 2020-04-25 14:17:48
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 364 bytes
コンパイル時間 84 ms
コンパイル使用メモリ 5,376 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 16:44:40
合計ジャッジ時間 1,180 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 27 ms
5,376 KB
testcase_13 AC 27 ms
5,376 KB
testcase_14 AC 26 ms
5,376 KB
testcase_15 AC 26 ms
5,376 KB
testcase_16 AC 28 ms
5,376 KB
testcase_17 AC 27 ms
5,376 KB
testcase_18 AC 26 ms
5,376 KB
testcase_19 AC 27 ms
5,376 KB
testcase_20 AC 25 ms
5,376 KB
testcase_21 AC 22 ms
5,376 KB
testcase_22 AC 20 ms
5,376 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
  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
  p=x
end
r=f
for i=0,v do r=mi(r,d[i]) end
print(r<f and r or -1)
0