結果

問題 No.1947 質より種類数
ユーザー kai4096_donkai4096_don
提出日時 2022-05-20 22:23:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 828 bytes
コンパイル時間 3,916 ms
コンパイル使用メモリ 233,688 KB
実行使用メモリ 814,796 KB
最終ジャッジ日時 2023-10-20 13:08:35
合計ジャッジ時間 10,925 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 2 ms
4,348 KB
testcase_04 AC 15 ms
10,732 KB
testcase_05 AC 11 ms
8,356 KB
testcase_06 AC 11 ms
8,620 KB
testcase_07 AC 13 ms
9,676 KB
testcase_08 AC 15 ms
10,732 KB
testcase_09 AC 56 ms
33,964 KB
testcase_10 AC 39 ms
24,724 KB
testcase_11 AC 123 ms
72,772 KB
testcase_12 AC 85 ms
50,860 KB
testcase_13 AC 32 ms
20,500 KB
testcase_14 AC 721 ms
385,332 KB
testcase_15 AC 345 ms
197,100 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 #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
//const long nPrime = 1000000007;
//const long nPrime = 998244353;
typedef long long ll;
int main() {
    ll n,u,c;
    cin >> n >> u >> c;
    vector<vector<vector<ll>>> vvviDP(n+1, vector<vector<ll>>(u+1,vector<ll>(2,0)));
    for(ll i = 1; i <= n; i++){
        ll v,w;
        cin >> v >> w;
        for(ll j = 0; j <= u; j++){
            vvviDP[i][j][0] = max(vvviDP[i-1][j][0], vvviDP[i-1][j][1]);
        }
        for(ll j = v; j <= u; j++){
            vvviDP[i][j][1] = max(vvviDP[i][j-v][0]+w+c, vvviDP[i][j-v][1]+w);
        }
    }

    ll nAns = 0;
    for(ll i = 0; i <= u; i++){
        nAns = max(nAns, vvviDP[n][i][0]);
        nAns = max(nAns, vvviDP[n][i][1]);
    }
    
    cout << nAns << endl;
    return 0;
}
0