結果
問題 | No.1947 質より種類数 |
ユーザー | rlangevin |
提出日時 | 2022-12-30 20:07:38 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 689 bytes |
コンパイル時間 | 1,512 ms |
コンパイル使用メモリ | 86,588 KB |
実行使用メモリ | 832,784 KB |
最終ジャッジ日時 | 2023-08-17 01:34:53 |
合計ジャッジ時間 | 9,705 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 70 ms
71,100 KB |
testcase_01 | AC | 71 ms
71,268 KB |
testcase_02 | AC | 70 ms
71,212 KB |
testcase_03 | AC | 69 ms
70,916 KB |
testcase_04 | AC | 138 ms
89,532 KB |
testcase_05 | AC | 125 ms
85,524 KB |
testcase_06 | AC | 128 ms
85,924 KB |
testcase_07 | AC | 133 ms
87,828 KB |
testcase_08 | AC | 138 ms
89,660 KB |
testcase_09 | AC | 234 ms
125,524 KB |
testcase_10 | AC | 200 ms
111,400 KB |
testcase_11 | AC | 403 ms
187,692 KB |
testcase_12 | AC | 304 ms
152,260 KB |
testcase_13 | AC | 183 ms
103,904 KB |
testcase_14 | TLE | - |
testcase_15 | AC | 1,343 ms
384,764 KB |
testcase_16 | MLE | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
ソースコード
import sys readline = sys.stdin.readline N, V, C = map(int, readline().split()) v, w = [0] * N, [0] * N for i in range(N): v[i], w[i] = map(int, readline().split()) inf = 10 ** 18 dp = [[[-inf] * 2 for i in range(V + 1) ] for j in range(N + 1)] dp[0][0][0] = 0 for i in range(N): for j in range(V + 1): dp[i + 1][j][0] = max(dp[i + 1][j][0], dp[i][j][0], dp[i][j][1]) if j - v[i] >= 0: dp[i + 1][j][1] = max(dp[i + 1][j][1], dp[i + 1][j - v[i]][0] + w[i] + C) dp[i + 1][j][1] = max(dp[i + 1][j][1], dp[i + 1][j - v[i]][1] + w[i]) ans = 0 for i in range(V + 1): ans = max(ans, dp[N][i][0], dp[N][i][1]) print(ans)