結果

問題 No.2693 Sword
ユーザー soldraysoldray
提出日時 2024-03-26 22:06:09
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 871 bytes
コンパイル時間 2,231 ms
コンパイル使用メモリ 159,692 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-26 22:06:13
合計ジャッジ時間 3,581 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 1 ms
6,676 KB
testcase_03 WA -
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 3 ms
6,676 KB
testcase_10 AC 1 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 AC 1 ms
6,676 KB
testcase_13 AC 2 ms
6,676 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 2 ms
6,676 KB
testcase_20 AC 2 ms
6,676 KB
testcase_21 AC 2 ms
6,676 KB
testcase_22 AC 1 ms
6,676 KB
testcase_23 AC 2 ms
6,676 KB
testcase_24 AC 2 ms
6,676 KB
testcase_25 WA -
testcase_26 AC 2 ms
6,676 KB
testcase_27 WA -
testcase_28 AC 1 ms
6,676 KB
testcase_29 AC 1 ms
6,676 KB
testcase_30 AC 2 ms
6,676 KB
testcase_31 AC 2 ms
6,676 KB
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

#define yn(pope) (pope ? "Yes" : "No")

#define rep(i, n, m) for (int i = (n); i < (m); i++)
#define rrep(i, n, m) for (int i = (n); i > m; i--)

#define IINF (1 << 30)
#define INF (1ll << 60)

#define all(v) v.begin(), v.end()

int main() {
  int N, K;
  i64 P;
  cin >> N >> P >> K;

  vector dp(K + 1, 0ll);

  dp[0] = P;

  rep(_, 0, N) {
    int t;
    i64 b;
    cin >> t >> b;

    vector cp = dp;

    if (t == 1) {
      rep(i, 0, K) { cp[i + 1] = max(dp[i + 1], dp[i] + b); }
    }

    if (t == 2) {
      rep(i, 0, K) { cp[i + 1] = max(dp[i + 1], dp[i] << 1); }
    }

    dp = cp;

    rep(i, 0, K + 1) {
      if (dp[i] >= 1000000000000000000ll) {
        dp[i] = 1000000000000000000ll;
      }
    }
  }

  cout << (dp[K] > 1000000000000000000ll ? -1 : dp[K]) << endl;

  return 0;
}
0