結果

問題 No.1037 exhausted
ユーザー konchanksukonchanksu
提出日時 2020-04-28 01:31:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 657 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 199,936 KB
最終ジャッジ日時 2024-05-02 07:20:35
合計ジャッジ時間 4,419 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
16,256 KB
testcase_01 AC 31 ms
10,624 KB
testcase_02 AC 30 ms
10,880 KB
testcase_03 AC 31 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 31 ms
10,752 KB
testcase_09 AC 31 ms
10,624 KB
testcase_10 AC 31 ms
10,880 KB
testcase_11 AC 32 ms
10,752 KB
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 = []
for i in range(N):
    t, m, p = map(int, input().split())
    if m == 0:
        continue 
    x.append([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(1, V + 1):
        if dp[i][j] != float('inf'):
            for k in range(len(x)):
                if x[k][0] == i + 1:
                    dp[i + 1][min(j - 1 + x[k][1], V)] = min(dp[i + 1][min(j - 1 + x[k][1], V)], dp[i][j] + x[k][2])
            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