結果

問題 No.2093 Shio Ramen
ユーザー Carpenters-CatCarpenters-Cat
提出日時 2022-10-07 21:30:34
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 379 bytes
コンパイル時間 1,904 ms
コンパイル使用メモリ 193,476 KB
最終ジャッジ日時 2025-02-07 22:53:37
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 19 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main () {
    int N, M;
    cin >> N >> M;
    vector<int> dp(M, 0);
    for (int i = 0; i < N; i ++) {
        int s, a;
        cin >> s >> a;
        if (s > M) {
            continue;
        }
        for (int j = M; j >= s; j --) {
            dp[j] = max(dp[j], dp[j - s] + a);
        }
    }
    cout << dp[M] << endl;
}
0