結果

問題 No.31 悪のミックスジュース
ユーザー szkhts
提出日時 2021-07-07 09:46:39
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
MLE  
実行時間 -
コード長 614 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 821,248 KB
最終ジャッジ日時 2024-07-01 12:19:05
合計ジャッジ時間 5,764 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 MLE * 1 -- * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

N, V = map(int, input().split())
packs = list(map(int, input().split()))
com = [i + 1 for i in range(V - N + 1)] * N
com_list = sorted(list(set(itertools.combinations(com, N))), reverse=True)
com_list_v = []
for c in com_list:
    temp = sorted(c, reverse=True)
    if sum(temp) == V and temp not in com_list_v:
        com_list_v.append(temp)

min_price = float('inf')
if N >= V:
    min_price = sum(packs)
else:
    for v in com_list_v:
        tmp = 0
        for i in range(len(v)):
            tmp += packs[i] * v[i]

        if min_price > tmp:
            min_price = tmp

print(min_price)
0