結果
問題 | No.2150 Site Supporter |
ユーザー |
![]() |
提出日時 | 2022-12-07 00:17:11 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 71 ms / 2,000 ms |
コード長 | 527 bytes |
コンパイル時間 | 2,551 ms |
コンパイル使用メモリ | 247,356 KB |
実行使用メモリ | 7,552 KB |
最終ジャッジ日時 | 2024-10-13 11:24:09 |
合計ジャッジ時間 | 4,117 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
#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; }