結果

問題 No.1037 exhausted
ユーザー konchanksukonchanksu
提出日時 2020-04-28 01:10:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 637 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 201,632 KB
最終ジャッジ日時 2024-05-02 06:52:21
合計ジャッジ時間 4,353 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
16,128 KB
testcase_01 AC 42 ms
10,752 KB
testcase_02 AC 37 ms
10,880 KB
testcase_03 AC 32 ms
10,752 KB
testcase_04 AC 32 ms
10,752 KB
testcase_05 AC 34 ms
10,880 KB
testcase_06 AC 32 ms
10,752 KB
testcase_07 WA -
testcase_08 AC 33 ms
10,752 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, V, L = map(int, input().split())
x = [[0, 0] for i in range(L + 1)] # 容量 かかる費用
for i in range(N):
    t, m, p = map(int, input().split())
    x[t] = [m, p]

dp = [[float('inf') for i in range(V + 1)] for j in range(L + 1)]
dp[0][V] = 0

for i in range(L):
    for j in range(V + 1):
        if dp[i][j] != float('inf'):
            dp[i][min(x[i][0] + j, V)] = min(dp[i][j] + x[i][1], dp[i][min(x[i][0] + j, V)])
            if j > 0:
                dp[i + 1][j - 1] = min(dp[i + 1][j - 1], dp[i][j])

ans = float('inf')
for i in dp[L]:
    ans = min(ans, i)

print(ans if ans != float('inf') else -1)
                
0