結果
問題 |
No.2150 Site Supporter
|
ユーザー |
![]() |
提出日時 | 2022-12-07 00:12:19 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 25 ms / 2,000 ms |
コード長 | 559 bytes |
コンパイル時間 | 2,073 ms |
コンパイル使用メモリ | 195,512 KB |
最終ジャッジ日時 | 2025-02-09 05:52:58 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
#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; }