結果

問題 No.2093 Shio Ramen
ユーザー 7iz67iz6
提出日時 2022-10-21 23:16:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 594 bytes
コンパイル時間 625 ms
コンパイル使用メモリ 72,284 KB
実行使用メモリ 7,624 KB
最終ジャッジ日時 2023-09-13 23:25:19
合計ジャッジ時間 4,626 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
7,356 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 4 ms
7,332 KB
testcase_05 AC 5 ms
7,332 KB
testcase_06 AC 4 ms
7,412 KB
testcase_07 AC 5 ms
7,348 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 5 ms
7,464 KB
testcase_13 AC 5 ms
7,312 KB
testcase_14 AC 5 ms
7,484 KB
testcase_15 RE -
testcase_16 RE -
testcase_17 AC 5 ms
7,588 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 WA -
testcase_21 AC 6 ms
7,384 KB
testcase_22 AC 6 ms
7,500 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
using namespace std;

struct Ramen {
    int s, a;
};

int main() {
    int N, I; cin >> N >> I;
    Ramen r[N];
    vector<vector<int>> dp(1006, vector<int>(1006, -1));
    for(int i = 0; i < N; i++) {
        cin >> r[i].s >> r[i].a;
    }
    dp[0][0] = 0;
    for(int i = 0; i < N; i++) {
        for(int j = 0; j <= I; j++) {
            if(dp[i][j] == -1) continue;
            dp[i + 1][r[i].s + j] = max(dp[i + 1][r[i].s + j], dp[i][j] + r[i].a);
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
        }
    }
    cout << dp[N][I] << endl;
}
0