結果

問題 No.31 悪のミックスジュース
ユーザー szkhtsszkhts
提出日時 2021-07-07 09:46:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
MLE  
実行時間 -
コード長 614 bytes
コンパイル時間 236 ms
コンパイル使用メモリ 10,912 KB
実行使用メモリ 816,984 KB
最終ジャッジ日時 2023-09-14 04:35:46
合計ジャッジ時間 5,188 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 802 ms
36,488 KB
testcase_01 MLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

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