結果
問題 | No.1037 exhausted |
ユーザー | 双六 |
提出日時 | 2020-08-03 00:23:43 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 780 bytes |
コンパイル時間 | 1,452 ms |
コンパイル使用メモリ | 86,532 KB |
実行使用メモリ | 139,712 KB |
最終ジャッジ日時 | 2023-09-27 03:53:13 |
合計ジャッジ時間 | 6,404 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 91 ms
71,356 KB |
testcase_01 | AC | 92 ms
71,316 KB |
testcase_02 | AC | 96 ms
71,496 KB |
testcase_03 | AC | 92 ms
71,652 KB |
testcase_04 | WA | - |
testcase_05 | AC | 92 ms
71,372 KB |
testcase_06 | AC | 92 ms
71,084 KB |
testcase_07 | WA | - |
testcase_08 | AC | 93 ms
71,352 KB |
testcase_09 | WA | - |
testcase_10 | AC | 92 ms
71,084 KB |
testcase_11 | WA | - |
testcase_12 | AC | 355 ms
128,096 KB |
testcase_13 | AC | 334 ms
130,512 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 348 ms
129,204 KB |
testcase_19 | WA | - |
testcase_20 | AC | 233 ms
109,464 KB |
testcase_21 | AC | 190 ms
100,204 KB |
testcase_22 | AC | 200 ms
100,088 KB |
ソースコード
import sys; input = sys.stdin.buffer.readline sys.setrecursionlimit(10**7) from collections import defaultdict con = 10 ** 9 + 7; INF = float("inf") def getlist(): return list(map(int, input().split())) #処理内容 def main(): N, V, L = getlist() DP = [[INF] * (V + 1) for i in range(N + 2)] DP[0][V] = 0 xnow = 0 for i in range(1, N + 1): x, v, w = getlist() for j in range(V + 1): if j >= v: DP[i][j] = min(DP[i][j], DP[i][j - v] + w) if j + (x - xnow) <= V: DP[i][j] = min(DP[i][j], DP[i - 1][j + (x - xnow)]) xnow = x for j in range(V + 1): if j + (L - xnow) <= V: DP[N + 1][j] = min(DP[N + 1][j], DP[N][j + (L - xnow)]) # print(DP) ans = min(DP[-1]) if ans == INF: print(-1) else: print(ans) if __name__ == '__main__': main()