結果

問題 No.2232 Miser's Gift
ユーザー GlinTFrauleinGlinTFraulein
提出日時 2023-03-03 23:37:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,010 bytes
コンパイル時間 2,234 ms
コンパイル使用メモリ 206,772 KB
実行使用メモリ 162,768 KB
最終ジャッジ日時 2023-10-18 03:46:35
合計ジャッジ時間 15,564 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
11,232 KB
testcase_01 AC 8 ms
11,232 KB
testcase_02 AC 9 ms
12,816 KB
testcase_03 AC 264 ms
162,768 KB
testcase_04 WA -
testcase_05 AC 131 ms
162,768 KB
testcase_06 AC 5 ms
8,064 KB
testcase_07 AC 136 ms
8,064 KB
testcase_08 AC 267 ms
162,768 KB
testcase_09 AC 266 ms
162,768 KB
testcase_10 AC 265 ms
162,768 KB
testcase_11 AC 265 ms
162,768 KB
testcase_12 AC 266 ms
162,768 KB
testcase_13 AC 262 ms
162,768 KB
testcase_14 AC 263 ms
162,768 KB
testcase_15 AC 262 ms
162,768 KB
testcase_16 AC 262 ms
162,768 KB
testcase_17 AC 261 ms
162,768 KB
testcase_18 AC 260 ms
162,768 KB
testcase_19 AC 261 ms
162,768 KB
testcase_20 AC 261 ms
162,768 KB
testcase_21 AC 259 ms
162,768 KB
testcase_22 AC 267 ms
162,768 KB
testcase_23 WA -
testcase_24 AC 265 ms
162,768 KB
testcase_25 WA -
testcase_26 AC 265 ms
162,768 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 265 ms
162,768 KB
testcase_32 WA -
testcase_33 AC 261 ms
162,768 KB
testcase_34 AC 262 ms
162,768 KB
testcase_35 AC 262 ms
162,768 KB
testcase_36 AC 261 ms
162,768 KB
testcase_37 AC 262 ms
162,768 KB
testcase_38 WA -
testcase_39 AC 115 ms
162,768 KB
testcase_40 AC 117 ms
162,768 KB
testcase_41 AC 117 ms
162,768 KB
testcase_42 AC 115 ms
162,768 KB
testcase_43 AC 116 ms
162,768 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 116 ms
162,768 KB
testcase_47 WA -
testcase_48 AC 116 ms
162,768 KB
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
//#include <atcoder/all>
 
#define elif else if
#define ll long long
#define vll vector<long long>
#define vec vector
#define embk emplace_back
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep3(i, n, k) for (int i = k; i < (int)(n); i++)
#define all(a) a.begin(), a.end()
 
using namespace std;
//using namespace atcoder;
const ll INF = 1LL << 60;
const ll mod = 998244353;

void printvec(vector<ll> a, ll b) {
  for (int i = 0; i <= b; i++) {
    cout << a[i];
    if (i == b) cout << endl;
    else cout << ' ';
  }
}

int main() {
  ll n, wl; cin >> n >> wl;
  vll w(n), v(n); rep(i, n) cin >> w[i] >> v[i];
  
  vec<vll> dp(n+1, vll(200000, 0));  //dp[品目][重さ] = 価値
  dp[0][0] = 0;
  
  rep(i, n) {
    rep(j, wl) {
      dp[i+1][j] = max(dp[i][j], dp[i+1][j]);
      dp[i+1][j+w[i]] = max(dp[i][j]+v[i], dp[i+1][j+w[i]]);
    }
  }
  
  rep3(i, wl+1, 1) {
    cout << dp[n][wl] - dp[n][wl-i] + 1 << endl;
  }
  
  //rep(i, n+1) printvec(dp[i], wl);
  
}
0