結果

問題 No.31 悪のミックスジュース
ユーザー vwxyzvwxyz
提出日時 2024-02-27 08:45:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 408 bytes
コンパイル時間 1,491 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2024-02-27 08:45:40
合計ジャッジ時間 9,951 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
9,984 KB
testcase_01 AC 577 ms
10,368 KB
testcase_02 AC 602 ms
10,368 KB
testcase_03 AC 842 ms
10,496 KB
testcase_04 AC 838 ms
10,496 KB
testcase_05 AC 892 ms
10,496 KB
testcase_06 AC 28 ms
9,984 KB
testcase_07 AC 866 ms
10,496 KB
testcase_08 AC 848 ms
10,496 KB
testcase_09 WA -
testcase_10 AC 778 ms
10,496 KB
testcase_11 AC 41 ms
9,984 KB
testcase_12 AC 331 ms
10,240 KB
testcase_13 AC 28 ms
9,984 KB
testcase_14 AC 772 ms
10,496 KB
testcase_15 AC 31 ms
9,984 KB
testcase_16 AC 64 ms
9,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,V=map(int,input().split())
C=[0]+list(map(int,input().split()))
for v in range(1,N+1):
    C[v]+=C[v-1]
V=max(V,N)
S=N*N
inf=1<<60
dp=[inf]*(S+1)
dp[N]=C[N]
for v in range(1,N):
    c=C[v]
    for s in range(v,S+1):
        dp[s]=min(dp[s],dp[s-v]+c)
ans=inf
for s in range(S+1):
    for v in range(1,N+1):
        c=C[v]
        if s<=V and (V-s)%v==0:
            ans=min(ans,dp[s]+(V-s)//v*c)
print(ans)
0