結果

問題 No.2150 Site Supporter
ユーザー _yurimoir
提出日時 2022-12-16 21:49:12
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 444 bytes
コンパイル時間 3,082 ms
コンパイル使用メモリ 249,792 KB
実行使用メモリ 14,780 KB
最終ジャッジ日時 2024-11-16 02:55:44
合計ジャッジ時間 5,608 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll n,k,x;
    cin>>n>>k>>x;
    vector<ll> a(n);
    for(auto& x:a)cin>>x;
    vector<vector<ll>> dp(n,vector<ll>(2,1e18));
    dp[0][0]=x+k;
    dp[0][1]=a[0];
    for(int i=1;i<n;i++){
        dp[i][0]=min(dp[i-1][0]+k,dp[i-1][1]+x+k);
        dp[i][1]=min(dp[i-1][0]+a[i],dp[i-1][1]+a[i]);
    }
    ll ans=min(dp[n-1][0],dp[n-1][1]);
    cout<<ans<<endl;
}
0