結果

問題 No.2150 Site Supporter
ユーザー ransewhaleransewhale
提出日時 2022-12-07 00:04:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 824 bytes
コンパイル時間 2,450 ms
コンパイル使用メモリ 76,740 KB
実行使用メモリ 8,324 KB
最終ジャッジ日時 2023-08-03 14:21:52
合計ジャッジ時間 2,503 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,928 KB
testcase_01 AC 3 ms
6,948 KB
testcase_02 AC 3 ms
6,852 KB
testcase_03 AC 3 ms
6,848 KB
testcase_04 AC 3 ms
6,924 KB
testcase_05 AC 3 ms
6,880 KB
testcase_06 AC 3 ms
6,868 KB
testcase_07 AC 3 ms
6,864 KB
testcase_08 AC 13 ms
7,032 KB
testcase_09 AC 67 ms
8,160 KB
testcase_10 AC 35 ms
7,816 KB
testcase_11 AC 62 ms
8,068 KB
testcase_12 AC 26 ms
7,488 KB
testcase_13 AC 17 ms
7,116 KB
testcase_14 AC 3 ms
6,916 KB
testcase_15 AC 3 ms
6,848 KB
testcase_16 AC 3 ms
6,856 KB
testcase_17 AC 73 ms
8,324 KB
testcase_18 AC 30 ms
7,404 KB
testcase_19 AC 11 ms
7,012 KB
testcase_20 AC 50 ms
7,952 KB
testcase_21 AC 8 ms
7,208 KB
testcase_22 AC 66 ms
8,224 KB
testcase_23 AC 3 ms
6,912 KB
testcase_24 AC 3 ms
6,920 KB
testcase_25 AC 3 ms
6,980 KB
testcase_26 AC 3 ms
6,864 KB
testcase_27 AC 43 ms
7,640 KB
testcase_28 AC 41 ms
7,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

#pragma GCC optimize("O2")

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll dp[225816][2],a[225816];;

int main(void){
	int n,i,j,k;
	ll x,y;
	std::fill(dp[0],dp[225816],INFLL);
	dp[0][0] = 0ll;
	std::cin >> n >> y >> x;
	for(i=0; i<n; ++i){
		std::cin >> a[i];
		for(j=0; j<2; ++j){
			for(k=0; k<2; ++k){
				dp[i+1][k] = std::min(dp[i+1][k],dp[i][j]+a[i]*(1-k)+y*k+x*((1-j)&k));
			}
		}
	}
	std::cout << (std::min(dp[n][0],dp[n][1])) << std::endl;
	return 0;
}
0