結果

問題 No.2150 Site Supporter
ユーザー t33f
提出日時 2022-12-07 00:23:15
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 386 bytes
コンパイル時間 530 ms
コンパイル使用メモリ 73,540 KB
最終ジャッジ日時 2025-02-09 05:53:16
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <tuple>
#include <vector>
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    long long k, x; cin >> k >> x;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];

    long long s = x, t = 0;
    for (int i = 0; i < n; ++i) {
        tie(s, t) = make_pair(min(s + k, t + k + x), min(s, t) + a[i]);
    }
    cout << min(s, t) << '\n';
}
0