結果

問題 No.2150 Site Supporter
ユーザー umezoumezo
提出日時 2022-12-07 00:12:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 559 bytes
コンパイル時間 2,231 ms
コンパイル使用メモリ 195,636 KB
実行使用メモリ 7,796 KB
最終ジャッジ日時 2024-04-21 12:49:16
合計ジャッジ時間 3,552 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 3 ms
6,940 KB
testcase_04 AC 4 ms
6,944 KB
testcase_05 AC 3 ms
6,940 KB
testcase_06 AC 3 ms
6,940 KB
testcase_07 AC 4 ms
6,944 KB
testcase_08 AC 6 ms
6,944 KB
testcase_09 AC 23 ms
7,676 KB
testcase_10 AC 13 ms
7,040 KB
testcase_11 AC 21 ms
7,552 KB
testcase_12 AC 10 ms
6,940 KB
testcase_13 AC 7 ms
6,940 KB
testcase_14 AC 3 ms
6,940 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 25 ms
7,796 KB
testcase_18 AC 11 ms
6,940 KB
testcase_19 AC 6 ms
6,944 KB
testcase_20 AC 17 ms
7,296 KB
testcase_21 AC 4 ms
6,944 KB
testcase_22 AC 22 ms
7,528 KB
testcase_23 AC 3 ms
6,940 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 AC 3 ms
6,940 KB
testcase_26 AC 3 ms
6,940 KB
testcase_27 AC 15 ms
7,124 KB
testcase_28 AC 14 ms
7,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;

ll dp[200200][2];
const ll INF=1e18;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  rep(i,200200) rep(j,2) dp[i][j]=INF;
  ll n,k,x;
  cin>>n>>k>>x;
  vector<ll> A(n+1);
  rep(i,n) cin>>A[i+1];
  dp[0][0]=0;

  for(int i=1;i<=n;i++){
    dp[i][0]=min(dp[i-1][0],dp[i-1][1])+A[i];
    dp[i][1]=min(dp[i-1][0]+x,dp[i-1][1])+k;
  }
  cout<<min(dp[n][0],dp[n][1])<<endl;
  
  return 0;
}
0