結果
| 問題 | No.2093 Shio Ramen |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-13 16:20:55 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 600 bytes |
| 記録 | |
| コンパイル時間 | 2,803 ms |
| コンパイル使用メモリ | 277,524 KB |
| 実行使用メモリ | 11,960 KB |
| 最終ジャッジ日時 | 2026-07-04 11:37:29 |
| 合計ジャッジ時間 | 4,223 ms |
|
ジャッジサーバーID (参考情報) |
temp-judge_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 30 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;
using mint = modint998244353;
int N, I, s[1010], a[1010];
int dp[1010][1010];
int main() {
cin >> N >> I;
for (int i = 0; i < N; i++) cin >> s[i] >> a[i];
for (int i = 0; i < N; i++) {
for (int j = 0; j <= I; j++) {
dp[i + 1][j] = dp[i][j];
if (j - s[i] >= 0) dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - s[i]] + a[i]);
}
}
int ans = 0;
for (int j = 0; j <= I; j++) ans = max(ans, dp[N][j]);
cout << ans << endl;
return 0;
}