結果

問題 No.2150 Site Supporter
ユーザー ygd.ygd.
提出日時 2022-12-13 22:42:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 194 ms / 2,000 ms
コード長 967 bytes
コンパイル時間 222 ms
コンパイル使用メモリ 10,884 KB
実行使用メモリ 28,976 KB
最終ジャッジ日時 2023-08-07 12:28:08
合計ジャッジ時間 4,389 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,668 KB
testcase_01 AC 18 ms
8,620 KB
testcase_02 AC 18 ms
8,616 KB
testcase_03 AC 18 ms
8,664 KB
testcase_04 AC 18 ms
8,544 KB
testcase_05 AC 19 ms
8,608 KB
testcase_06 AC 18 ms
8,752 KB
testcase_07 AC 18 ms
8,548 KB
testcase_08 AC 42 ms
11,144 KB
testcase_09 AC 173 ms
27,120 KB
testcase_10 AC 99 ms
17,668 KB
testcase_11 AC 166 ms
26,120 KB
testcase_12 AC 75 ms
15,396 KB
testcase_13 AC 51 ms
12,456 KB
testcase_14 AC 18 ms
8,632 KB
testcase_15 AC 18 ms
8,716 KB
testcase_16 AC 18 ms
8,732 KB
testcase_17 AC 194 ms
28,976 KB
testcase_18 AC 85 ms
16,548 KB
testcase_19 AC 38 ms
11,056 KB
testcase_20 AC 133 ms
22,200 KB
testcase_21 AC 31 ms
9,864 KB
testcase_22 AC 175 ms
26,880 KB
testcase_23 AC 18 ms
8,668 KB
testcase_24 AC 18 ms
8,680 KB
testcase_25 AC 18 ms
8,584 KB
testcase_26 AC 18 ms
8,660 KB
testcase_27 AC 111 ms
19,592 KB
testcase_28 AC 107 ms
18,620 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#input = sys.stdin.readline
#input = sys.stdin.buffer.readline #文字列はダメ
sys.setrecursionlimit(1000000)
import math
import bisect
#import itertools
#import random
#from heapq import heapify, heappop, heappush
from collections import defaultdict
from collections import deque
#import copy #DeepCopy: hoge = [_[:] for _ in hogehoge]
#from functools import lru_cache
#@lru_cache(maxsize=None)
#MOD = pow(10,9) + 7
MOD = 998244353
#dx = [1,0,-1,0]
#dy = [0,1,0,-1]
#dx8 = [1,1,0,-1,-1,-1,0,1]
#dy8 = [0,1,1,1,0,-1,-1,-1]

def main():
    N,K,X = map(int,input().split()); INF = 1<<60
    A = list(map(int,input().split()))

    # dp[i][j]; i番目まで見てj=0前日会員ではない、1前日会員の時の最小値
    dp = [0,INF]
    for a in A:
        p = [INF,INF]
        p,dp = dp,p
        dp[0] = min(p[0] + a, p[1] + a)
        dp[1] = min(p[0] + K+X, p[1] + K)
    ans = min(dp)
    print(ans)


if __name__ == '__main__':
    main()
0