結果

問題 No.2150 Site Supporter
ユーザー norikamenorikame
提出日時 2022-12-07 17:01:41
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 779 bytes
コンパイル時間 6,237 ms
コンパイル使用メモリ 336,556 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-22 00:04:41
合計ジャッジ時間 7,063 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 12 ms
5,376 KB
testcase_09 AC 65 ms
5,376 KB
testcase_10 AC 33 ms
5,376 KB
testcase_11 AC 60 ms
5,376 KB
testcase_12 AC 25 ms
5,376 KB
testcase_13 AC 15 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 72 ms
5,376 KB
testcase_18 AC 29 ms
5,376 KB
testcase_19 AC 10 ms
5,376 KB
testcase_20 AC 49 ms
5,376 KB
testcase_21 AC 7 ms
5,376 KB
testcase_22 AC 70 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 43 ms
5,376 KB
testcase_28 AC 43 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// 

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;

using ll = long long;

#define rep(i, n) for (int i=0; i<(int)(n); ++(i))
#define rep3(i, m, n) for (int i=(m); (i)<(int)(n); ++(i))
#define repr(i, n) for (int i=(int)(n)-1; (i)>=0; --(i))
#define rep3r(i, m, n) for (int i=(int)(n)-1; (i)>=(int)(m); --(i))
#define all(x) (x).begin(), (x).end()

const ll LINF = (ll)(1e18);

int main() {
	int n, k, x;
	cin >> n >> k >> x;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	vector<vector<ll>> dp(2, vector<ll>(2, LINF));
	dp[0][0] = 0;
	rep(i, n) {
		dp[(i+1)%2][0] = min(dp[i%2][0], dp[i%2][1]) + a[i];
		dp[(i+1)%2][1] = min(dp[i%2][0]+x+k, dp[i%2][1]+k);
	}
	ll res = min(dp[n%2][0], dp[n%2][1]);
	cout << res << endl;
	return 0;
}
0