結果
問題 | No.2093 Shio Ramen |
ユーザー |
|
提出日時 | 2022-10-07 22:44:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 389 bytes |
コンパイル時間 | 1,613 ms |
コンパイル使用メモリ | 168,316 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 20:00:43 |
合計ジャッジ時間 | 2,191 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 30 |
ソースコード
#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 + s], dp[i] + a); } } cout << dp[I] << '\n'; }