結果

問題 No.1947 質より種類数
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2022-05-20 22:52:32
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 652 bytes
コンパイル時間 1,886 ms
コンパイル使用メモリ 174,308 KB
実行使用メモリ 814,900 KB
最終ジャッジ日時 2023-10-20 13:43:02
合計ジャッジ時間 8,357 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 15 ms
10,684 KB
testcase_05 AC 11 ms
8,308 KB
testcase_06 AC 11 ms
8,572 KB
testcase_07 AC 13 ms
9,628 KB
testcase_08 AC 15 ms
10,684 KB
testcase_09 AC 56 ms
33,916 KB
testcase_10 AC 39 ms
24,676 KB
testcase_11 AC 124 ms
72,724 KB
testcase_12 AC 86 ms
50,812 KB
testcase_13 AC 32 ms
20,452 KB
testcase_14 AC 666 ms
385,300 KB
testcase_15 AC 346 ms
197,068 KB
testcase_16 MLE -
testcase_17 MLE -
testcase_18 MLE -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2022.05.20 22:52:30
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;


int main() {
    int n,V,C;cin >> n >> V >> C;
    vector<vector<vector<ll>>> dp(n+1,vector<vector<ll>>(V+1,vector<ll>(2)));
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        int v,w;cin >> v >> w;
        for (int j = 0; j <= V; j++) {
            dp[i+1][j][0] = max(dp[i][j][0],dp[i][j][1]);
            if (j>=v) dp[i+1][j][1] = max(dp[i+1][j-v][0]+C+w,dp[i+1][j-v][1]+w);
            ans = max(dp[i+1][j][0],dp[i+1][j][1]);
        }
    }
    cout << ans << endl;
    return 0;
}
0