結果

問題 No.31 悪のミックスジュース
ユーザー tnodinotnodino
提出日時 2022-04-06 04:24:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 503 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 86,820 KB
実行使用メモリ 81,136 KB
最終ジャッジ日時 2023-08-18 10:48:16
合計ジャッジ時間 3,903 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
76,456 KB
testcase_01 AC 180 ms
78,044 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 185 ms
81,136 KB
testcase_05 AC 186 ms
81,080 KB
testcase_06 AC 67 ms
71,380 KB
testcase_07 AC 198 ms
76,560 KB
testcase_08 AC 194 ms
76,444 KB
testcase_09 AC 200 ms
78,288 KB
testcase_10 AC 69 ms
71,116 KB
testcase_11 AC 106 ms
76,552 KB
testcase_12 AC 154 ms
78,068 KB
testcase_13 AC 74 ms
76,552 KB
testcase_14 AC 194 ms
76,452 KB
testcase_15 AC 94 ms
76,544 KB
testcase_16 AC 121 ms
78,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

INF = 1<<64
N,V = map(int,input().split())
C = list(map(int,input().split()))
S = [0] * (N + 1)
for i in range(N):
    S[i+1] = S[i] + C[i]
if V <= N:
    print(S[N])
    exit()
DP = [INF] * (1<<16)
DP[0] = 0
for i in range(1,N+1):
    for L in range(1<<16):
        if L - i >= 0:
            DP[L] = min(DP[L-i] + S[i], DP[L])
V -= N
ans = INF
for i in range(1,N+1):
    K = V // i
    while V - (K * i) <= (1<<12) and K:
        K -= 1
    ans = min(ans, S[i] * K + DP[V - (K * i)] + S[N])
print(ans)
0