結果

問題 No.1463 Hungry Kanten
ユーザー H3PO4H3PO4
提出日時 2021-04-02 21:32:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 376 ms / 2,000 ms
コード長 318 bytes
コンパイル時間 123 ms
コンパイル使用メモリ 10,652 KB
実行使用メモリ 28,844 KB
最終ジャッジ日時 2023-08-25 14:49:07
合計ジャッジ時間 2,747 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,588 KB
testcase_01 AC 21 ms
8,728 KB
testcase_02 AC 35 ms
9,408 KB
testcase_03 AC 339 ms
8,704 KB
testcase_04 AC 18 ms
8,752 KB
testcase_05 AC 376 ms
28,844 KB
testcase_06 AC 19 ms
8,700 KB
testcase_07 AC 19 ms
8,708 KB
testcase_08 AC 19 ms
8,704 KB
testcase_09 AC 19 ms
8,740 KB
testcase_10 AC 19 ms
8,600 KB
testcase_11 AC 20 ms
8,684 KB
testcase_12 AC 20 ms
8,672 KB
testcase_13 AC 20 ms
8,744 KB
testcase_14 AC 23 ms
8,920 KB
testcase_15 AC 20 ms
8,672 KB
testcase_16 AC 33 ms
9,580 KB
testcase_17 AC 61 ms
11,968 KB
testcase_18 AC 30 ms
9,312 KB
testcase_19 AC 189 ms
18,696 KB
testcase_20 AC 256 ms
28,064 KB
testcase_21 AC 20 ms
8,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import functools
import operator
import itertools

N, K = map(int, input().split())
A = tuple(map(int, input().split()))

prod = functools.partial(functools.reduce, operator.mul)

st = set()
for x in range(K,N+1):
    for t in itertools.combinations(A, x):
        st.add(sum(t))
        st.add(prod(t))
print(len(st))
0