結果

問題 No.2150 Site Supporter
ユーザー norikamenorikame
提出日時 2022-12-07 17:01:41
言語 C++23(draft)
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 779 bytes
コンパイル時間 5,179 ms
コンパイル使用メモリ 308,372 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-04 01:30:27
合計ジャッジ時間 7,539 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 11 ms
4,376 KB
testcase_09 AC 63 ms
4,376 KB
testcase_10 AC 33 ms
4,380 KB
testcase_11 AC 59 ms
4,380 KB
testcase_12 AC 24 ms
4,376 KB
testcase_13 AC 14 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 70 ms
4,380 KB
testcase_18 AC 28 ms
4,376 KB
testcase_19 AC 10 ms
4,376 KB
testcase_20 AC 47 ms
4,376 KB
testcase_21 AC 6 ms
4,504 KB
testcase_22 AC 64 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 41 ms
4,380 KB
testcase_28 AC 38 ms
4,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