結果
| 問題 | No.2232 Miser's Gift |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-03 21:27:50 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 2,000 ms |
| コード長 | 520 bytes |
| 記録 | |
| コンパイル時間 | 1,365 ms |
| コンパイル使用メモリ | 210,960 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-06-29 18:57:41 |
| 合計ジャッジ時間 | 3,524 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 55 |
ソースコード
#include <bits/stdc++.h>
using i64 = long long;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int N, W;
std::cin >> N >> W;
std::vector dp(W + 1, 0);
for (int i = 0; i < N; i++) {
int w, v;
std::cin >> w >> v;
for (int j = W; j >= w; j--) {
dp[j] = std::max(dp[j], dp[j - w] + v);
}
}
for (int x = 1; x <= W; x++) {
std::cout << dp[W] - dp[W - x] + 1 << "\n";
}
return 0;
}