結果

問題 No.2150 Site Supporter
ユーザー trineutrontrineutron
提出日時 2022-12-07 00:17:11
言語 C++23(draft)
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 527 bytes
コンパイル時間 2,891 ms
コンパイル使用メモリ 245,140 KB
実行使用メモリ 7,240 KB
最終ジャッジ日時 2023-08-03 14:32:13
合計ジャッジ時間 4,979 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,388 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 1 ms
4,384 KB
testcase_07 AC 1 ms
4,384 KB
testcase_08 AC 11 ms
4,384 KB
testcase_09 AC 65 ms
6,944 KB
testcase_10 AC 35 ms
4,804 KB
testcase_11 AC 61 ms
6,864 KB
testcase_12 AC 25 ms
4,384 KB
testcase_13 AC 15 ms
4,384 KB
testcase_14 AC 1 ms
4,384 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 72 ms
7,240 KB
testcase_18 AC 29 ms
4,548 KB
testcase_19 AC 9 ms
4,380 KB
testcase_20 AC 48 ms
5,960 KB
testcase_21 AC 6 ms
4,384 KB
testcase_22 AC 65 ms
7,128 KB
testcase_23 AC 1 ms
4,384 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 1 ms
4,384 KB
testcase_26 AC 1 ms
4,384 KB
testcase_27 AC 42 ms
5,432 KB
testcase_28 AC 39 ms
5,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

constexpr int64_t inf = 1e18;

int main() {
    int n, k, x;
    cin >> n >> k >> x;
    vector<int64_t> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
    }

    vector<int64_t> dp0(n + 1, inf), dp1(n + 1, inf);
    dp0.at(0) = 0;
    for (int i = 0; i < n; i++) {
        dp0.at(i + 1) = min(dp0.at(i), dp1.at(i)) + a.at(i);
        dp1.at(i + 1) = min(dp0.at(i) + k + x, dp1.at(i) + k);
    }

    cout << min(dp0.back(), dp1.back()) << endl;

    return 0;
}
0