結果

問題 No.2150 Site Supporter
ユーザー lloyzlloyz
提出日時 2022-12-14 01:27:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 235 ms / 2,000 ms
コード長 637 bytes
コンパイル時間 495 ms
コンパイル使用メモリ 86,648 KB
実行使用メモリ 106,192 KB
最終ジャッジ日時 2023-08-07 14:25:49
合計ジャッジ時間 6,508 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
70,960 KB
testcase_01 AC 79 ms
70,992 KB
testcase_02 AC 76 ms
71,240 KB
testcase_03 AC 77 ms
71,084 KB
testcase_04 AC 74 ms
71,144 KB
testcase_05 AC 75 ms
70,960 KB
testcase_06 AC 75 ms
71,056 KB
testcase_07 AC 77 ms
71,088 KB
testcase_08 AC 118 ms
80,444 KB
testcase_09 AC 224 ms
105,520 KB
testcase_10 AC 160 ms
90,692 KB
testcase_11 AC 204 ms
102,312 KB
testcase_12 AC 144 ms
86,172 KB
testcase_13 AC 124 ms
82,280 KB
testcase_14 AC 77 ms
71,292 KB
testcase_15 AC 76 ms
71,268 KB
testcase_16 AC 78 ms
71,172 KB
testcase_17 AC 235 ms
106,192 KB
testcase_18 AC 151 ms
87,428 KB
testcase_19 AC 120 ms
79,716 KB
testcase_20 AC 184 ms
97,044 KB
testcase_21 AC 111 ms
78,564 KB
testcase_22 AC 216 ms
105,876 KB
testcase_23 AC 77 ms
70,916 KB
testcase_24 AC 76 ms
71,308 KB
testcase_25 AC 76 ms
71,308 KB
testcase_26 AC 75 ms
71,136 KB
testcase_27 AC 168 ms
92,924 KB
testcase_28 AC 160 ms
92,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k, x = map(int, input().split())
A = list(map(int, input().split()))

INF = 10**18
DP = [[INF for _ in range(3)] for _ in range(n + 1)]
DP[0][0] = 0
for i in range(n):
    a = A[i]
    for j in range(3):
        if DP[i][j] != INF:
            for l in range(3):
                if l == 0:
                    DP[i + 1][l] = min(DP[i + 1][l], DP[i][j] + a)
                elif l == 1:
                    if j == 0:
                        DP[i + 1][l] = min(DP[i + 1][l], DP[i][j] + k + x)
                else:
                    if j != 0:
                        DP[i + 1][l] = min(DP[i + 1][l], DP[i][j] + k)
print(min(DP[n]))
0