結果
問題 | No.2093 Shio Ramen |
ユーザー |
|
提出日時 | 2022-10-07 21:33:03 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 536 bytes |
コンパイル時間 | 2,209 ms |
コンパイル使用メモリ | 196,532 KB |
最終ジャッジ日時 | 2025-02-07 22:55:20 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); // sum(s) <= I // max sum(a) int N,I; cin >> N >> I; vector<int> dp(I + 1, 0); rep(_,N) { int s,a; cin >> s >> a; vector<int> nt = dp; for(int i = 0; i <= I; i++) if(i + s <= I) nt[i + s] = max(nt[i + s], dp[i] + a); swap(dp, nt); } cout << *max_element(dp.begin(), dp.end()) << endl; }