結果

問題 No.1037 exhausted
ユーザー Kiri8128Kiri8128
提出日時 2020-04-24 22:26:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 628 bytes
コンパイル時間 450 ms
コンパイル使用メモリ 86,992 KB
実行使用メモリ 78,096 KB
最終ジャッジ日時 2023-08-05 05:22:17
合計ジャッジ時間 3,978 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,376 KB
testcase_01 AC 68 ms
71,348 KB
testcase_02 AC 68 ms
71,128 KB
testcase_03 AC 66 ms
71,224 KB
testcase_04 AC 68 ms
71,400 KB
testcase_05 AC 68 ms
71,076 KB
testcase_06 AC 67 ms
71,312 KB
testcase_07 AC 67 ms
71,240 KB
testcase_08 AC 68 ms
71,284 KB
testcase_09 AC 68 ms
71,276 KB
testcase_10 AC 68 ms
71,216 KB
testcase_11 AC 67 ms
71,084 KB
testcase_12 AC 131 ms
77,876 KB
testcase_13 AC 130 ms
78,096 KB
testcase_14 AC 130 ms
77,792 KB
testcase_15 AC 130 ms
77,876 KB
testcase_16 AC 134 ms
77,840 KB
testcase_17 AC 136 ms
77,992 KB
testcase_18 AC 132 ms
77,820 KB
testcase_19 AC 132 ms
78,052 KB
testcase_20 AC 101 ms
77,364 KB
testcase_21 AC 98 ms
77,200 KB
testcase_22 AC 100 ms
77,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def calc(S, v, w):
    T = sorted(S[:] + [(min(s[0] + v, V), s[1] + w) for s in S], key = lambda x: -x[0])
    U = []
    prew = 1 << 100
    prev = 1 << 100
    for t in T:
        if t[1] < prew:
            if t[0] == prev:
                U.pop()
            U.append(t)
            prew = t[1]
            prev = t[0]
    return U

N, V, L = map(int, input().split())
S = [(V, 0)]
prex = 0
for _ in range(N):
    x, v, w = map(int, input().split())
    dx = x - prex
    prex = x
    S = [(v - dx, w) for v, w in S if v >= dx]
    S = calc(S, v, w)

dx = L - prex
A = [w for v, w in S if v >= dx]
print(min(A) if A else -1)
0