結果

問題 No.1463 Hungry Kanten
ユーザー ganariyaganariya
提出日時 2021-04-03 19:44:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,242 ms / 2,000 ms
コード長 468 bytes
コンパイル時間 185 ms
コンパイル使用メモリ 10,888 KB
実行使用メモリ 28,948 KB
最終ジャッジ日時 2023-08-26 15:35:18
合計ジャッジ時間 6,662 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
8,644 KB
testcase_01 AC 22 ms
8,644 KB
testcase_02 AC 63 ms
9,420 KB
testcase_03 AC 1,155 ms
8,672 KB
testcase_04 AC 21 ms
8,636 KB
testcase_05 AC 1,242 ms
28,948 KB
testcase_06 AC 20 ms
8,664 KB
testcase_07 AC 21 ms
8,684 KB
testcase_08 AC 20 ms
8,728 KB
testcase_09 AC 20 ms
8,584 KB
testcase_10 AC 21 ms
8,676 KB
testcase_11 AC 22 ms
8,608 KB
testcase_12 AC 23 ms
8,752 KB
testcase_13 AC 22 ms
8,608 KB
testcase_14 AC 34 ms
8,940 KB
testcase_15 AC 25 ms
8,684 KB
testcase_16 AC 65 ms
9,620 KB
testcase_17 AC 156 ms
12,056 KB
testcase_18 AC 80 ms
9,440 KB
testcase_19 AC 594 ms
18,788 KB
testcase_20 AC 825 ms
28,144 KB
testcase_21 AC 22 ms
8,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import product
from operator import mul
from functools import reduce

N, K = map(int, input().split())
A = [int(x) for x in input().split()]

s = set()
for p in product([0, 1], repeat=N):
    if list(p).count(1) < K:
        continue
    s.add(sum(A[i] for i in range(N) if p[i]))
    # s.add(reduce((lambda x, y: x * y), (A[i] for i in range(N) if p[i])))
    s.add(reduce(mul, (A[i] for i in range(N) if p[i])))

print(len(s))

z = lambda x, y: x * y
0