結果
問題 | No.247 線形計画問題もどき |
ユーザー |
👑 |
提出日時 | 2022-10-27 12:59:36 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 129 ms / 2,000 ms |
コード長 | 437 bytes |
コンパイル時間 | 176 ms |
コンパイル使用メモリ | 6,816 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-04 22:54:20 |
合計ジャッジ時間 | 1,310 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 23 |
ソースコード
local c = io.read("*n")local n = io.read("*n")local a = {}for i = 1, n doa[i] = io.read("*n")endlocal t = {}for i = 1, c dot[i] = -1endfor i = 1, n dolocal ai = a[i]if ai <= c thenif t[ai] < 0 or 1 < t[ai] then t[ai] = 1 endendfor j = 1, c - ai dolocal dst = j + aiif 0 <= t[j] thenif t[dst] < 0 or t[j] + 1 < t[dst] thent[dst] = t[j] + 1endendendendprint(t[c])