結果

問題 No.31 悪のミックスジュース
ユーザー tnodinotnodino
提出日時 2022-04-04 18:02:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 545 bytes
コンパイル時間 257 ms
コンパイル使用メモリ 10,904 KB
実行使用メモリ 8,436 KB
最終ジャッジ日時 2023-08-16 20:04:34
合計ジャッジ時間 1,659 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 32 ms
8,336 KB
testcase_05 AC 31 ms
8,212 KB
testcase_06 AC 14 ms
8,196 KB
testcase_07 AC 31 ms
8,436 KB
testcase_08 AC 31 ms
8,348 KB
testcase_09 WA -
testcase_10 AC 15 ms
8,224 KB
testcase_11 WA -
testcase_12 AC 26 ms
7,976 KB
testcase_13 AC 14 ms
7,812 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

INF = 1<<100
N,V = map(int,input().split())
C = list(map(int,input().split()))
S = [0] * N
for i in range(N):
    S[i] = S[i-1] + C[i]
if V <= N:
    print(S[-1])
    exit()
DP = [[INF] * 101 for _ in range(N+1)]
DP[0][0] = 0
for i in range(N):
    for j in range(101):
        DP[i+1][j] = min(DP[i][j], DP[i+1][j])
        k = min(100, (i + 1) + j)
        DP[i+1][k] = min(DP[i][j] + S[i], DP[i+1][j] + S[i], DP[i+1][k])
V -= N
ans = INF
for i in range(N):
    ans = min(ans, (S[i] * (V // (i + 1))) + (DP[N][V % (i + 1)]) + S[-1])
print(ans)
0