結果

問題 No.1463 Hungry Kanten
ユーザー c-yanc-yan
提出日時 2021-04-02 21:53:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,100 ms / 2,000 ms
コード長 340 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 10,692 KB
実行使用メモリ 28,952 KB
最終ジャッジ日時 2023-08-25 14:57:01
合計ジャッジ時間 5,167 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,768 KB
testcase_01 AC 15 ms
8,660 KB
testcase_02 AC 60 ms
9,488 KB
testcase_03 AC 1,082 ms
8,724 KB
testcase_04 AC 17 ms
8,716 KB
testcase_05 AC 1,100 ms
28,952 KB
testcase_06 AC 18 ms
8,588 KB
testcase_07 AC 17 ms
8,628 KB
testcase_08 AC 16 ms
8,592 KB
testcase_09 AC 17 ms
8,628 KB
testcase_10 AC 17 ms
8,796 KB
testcase_11 AC 18 ms
8,620 KB
testcase_12 AC 20 ms
8,888 KB
testcase_13 AC 18 ms
8,652 KB
testcase_14 AC 30 ms
8,912 KB
testcase_15 AC 22 ms
8,700 KB
testcase_16 AC 58 ms
9,652 KB
testcase_17 AC 140 ms
11,976 KB
testcase_18 AC 73 ms
9,540 KB
testcase_19 AC 543 ms
18,708 KB
testcase_20 AC 761 ms
28,128 KB
testcase_21 AC 18 ms
8,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import product
from functools import reduce

N, K, *A = map(int, open(0).read().split())

s = set()
for p in product([True, False], repeat=N):
    if list(p).count(True) < 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])))
print(len(s))
0