結果

問題 No.1463 Hungry Kanten
ユーザー ganariya
提出日時 2021-04-03 19:44:30
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,244 ms / 2,000 ms
コード長 468 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 30,624 KB
最終ジャッジ日時 2025-06-20 01:35:15
合計ジャッジ時間 7,060 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

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