結果

問題 No.1463 Hungry Kanten
ユーザー MisterMister
提出日時 2021-05-01 01:54:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,702 ms / 2,000 ms
コード長 322 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 10,584 KB
実行使用メモリ 28,316 KB
最終ジャッジ日時 2023-09-26 10:50:25
合計ジャッジ時間 8,092 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,768 KB
testcase_01 AC 15 ms
7,720 KB
testcase_02 AC 73 ms
8,792 KB
testcase_03 AC 1,677 ms
7,732 KB
testcase_04 AC 17 ms
7,764 KB
testcase_05 AC 1,702 ms
28,316 KB
testcase_06 AC 16 ms
7,760 KB
testcase_07 AC 16 ms
7,756 KB
testcase_08 AC 16 ms
7,900 KB
testcase_09 AC 16 ms
7,716 KB
testcase_10 AC 16 ms
7,908 KB
testcase_11 AC 18 ms
7,752 KB
testcase_12 AC 20 ms
8,304 KB
testcase_13 AC 18 ms
7,820 KB
testcase_14 AC 32 ms
8,244 KB
testcase_15 AC 21 ms
7,936 KB
testcase_16 AC 74 ms
9,048 KB
testcase_17 AC 199 ms
11,400 KB
testcase_18 AC 84 ms
8,916 KB
testcase_19 AC 806 ms
18,276 KB
testcase_20 AC 1,149 ms
27,652 KB
testcase_21 AC 17 ms
7,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
xs = list(map(int, input().split()))

ys = set()
for b in range(1 << n):
    if bin(b).count('1') < k:
        continue

    s, p = 0, 1
    for i in range(n):
        if (~b >> i) & 1:
            continue
        s += xs[i]
        p *= xs[i]
    ys.add(s)
    ys.add(p)

print(len(ys))
0