結果

問題 No.1037 exhausted
ユーザー c-yanc-yan
提出日時 2020-04-24 23:04:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 561 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 18,204 KB
最終ジャッジ日時 2024-04-23 04:09:07
合計ジャッジ時間 15,671 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

N, V, L = map(int, input().split())

cx = 0
d = {}
d[V] = 0
for _ in range(N):
    x, v, w = map(int, input().split())
    nd = {}
    for k in d:
        t = k - (x - cx)
        if t < 0:
            continue
        if t not in nd or nd[t] > d[k]:
            nd[t] = d[k]
        t = min(t + v, V)
        if t not in nd or nd[t] > d[k] + w:
            nd[t] = d[k] + w
    if len(nd) == 0:
        print(-1)
        exit()
    d = nd
    cx = x

result = float('inf')
for k in d:
    if k - (L - cx) >= 0:
        result = min(result, d[k])
print(result)
0