結果

問題 No.2093 Shio Ramen
ユーザー t98slider
提出日時 2022-10-07 22:42:40
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 385 bytes
コンパイル時間 1,515 ms
コンパイル使用メモリ 168,124 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-12 19:57:19
合計ジャッジ時間 2,497 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 2 WA * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, I, s, a;
    cin >> n >> I;
    vector<int> dp(I + 1, 0);
    dp[0] = 0;
    while(n--){
        cin >> s >> a;
        for(int i = I - s; i >= 0; i--){
            dp[i + s] = max(dp[i], dp[i] + a);
        }
    }
    cout << dp[I] << '\n';
}
0