結果

問題 No.2317 Expression Menu
ユーザー unibopunibop
提出日時 2023-05-31 23:48:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 1,045 bytes
コンパイル時間 3,026 ms
コンパイル使用メモリ 166,592 KB
実行使用メモリ 216,008 KB
最終ジャッジ日時 2023-08-28 01:42:53
合計ジャッジ時間 8,188 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,460 KB
testcase_01 AC 2 ms
5,576 KB
testcase_02 AC 8 ms
19,032 KB
testcase_03 AC 145 ms
215,748 KB
testcase_04 AC 139 ms
215,824 KB
testcase_05 AC 137 ms
215,736 KB
testcase_06 AC 140 ms
215,792 KB
testcase_07 AC 141 ms
215,736 KB
testcase_08 AC 135 ms
215,796 KB
testcase_09 AC 109 ms
215,732 KB
testcase_10 AC 85 ms
215,980 KB
testcase_11 AC 85 ms
215,736 KB
testcase_12 AC 84 ms
215,744 KB
testcase_13 AC 84 ms
215,900 KB
testcase_14 AC 85 ms
215,788 KB
testcase_15 AC 84 ms
215,724 KB
testcase_16 AC 84 ms
215,760 KB
testcase_17 AC 84 ms
215,736 KB
testcase_18 AC 84 ms
215,808 KB
testcase_19 AC 86 ms
215,748 KB
testcase_20 AC 85 ms
215,820 KB
testcase_21 AC 104 ms
215,752 KB
testcase_22 AC 83 ms
215,740 KB
testcase_23 AC 104 ms
215,784 KB
testcase_24 AC 104 ms
215,788 KB
testcase_25 AC 103 ms
215,804 KB
testcase_26 AC 105 ms
215,736 KB
testcase_27 AC 105 ms
215,820 KB
testcase_28 AC 105 ms
215,752 KB
testcase_29 AC 105 ms
215,756 KB
testcase_30 AC 110 ms
215,752 KB
testcase_31 AC 105 ms
215,732 KB
testcase_32 AC 105 ms
215,752 KB
testcase_33 AC 1 ms
4,376 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 1 ms
4,376 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 108 ms
216,008 KB
testcase_39 AC 106 ms
215,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <stack>
#include <queue>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <bitset>
#include <atcoder/all>
#define rep(i,n) for(int i = 0; i < n; i++)

using namespace std;
using namespace atcoder;
using ll = long long;

long long dp[301][301][301];
int main() {
    int n, x, y;
    cin >> n >> x >> y;

    for (int i = 1; i <= n; i++) {
        int a, b;
        long long c;
        cin >> a >> b >> c;
        for (int j = 1; j <= x; j++) {
            for (int k = 1; k <= y; k++) {
                dp[i][j][k] = dp[i - 1][j][k];
                if (j - a >= 0 && k - b >= 0) {
                    dp[i][j][k] = max(dp[i][j][k], dp[i - 1][j - a][k - b] + c);
                }
            }
        }
    }
    
    long long ans = 0;
    for (int j = 0; j <= x; j++) {
        for (int k = 0; k <= y; k++) {
            ans = max(ans, dp[n][j][k]);
        }
    }
    
    cout << ans << endl;
    return 0;
}
0