結果

問題 No.1463 Hungry Kanten
ユーザー wattaiheiwattaihei
提出日時 2021-04-02 21:32:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 342 ms / 2,000 ms
コード長 360 bytes
コンパイル時間 234 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 122,620 KB
最終ジャッジ日時 2023-08-25 14:49:11
合計ジャッジ時間 3,634 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
70,948 KB
testcase_01 AC 62 ms
71,032 KB
testcase_02 AC 92 ms
77,820 KB
testcase_03 AC 290 ms
77,068 KB
testcase_04 AC 65 ms
76,196 KB
testcase_05 AC 342 ms
122,620 KB
testcase_06 AC 59 ms
71,092 KB
testcase_07 AC 63 ms
71,184 KB
testcase_08 AC 61 ms
71,356 KB
testcase_09 AC 57 ms
71,028 KB
testcase_10 AC 63 ms
76,280 KB
testcase_11 AC 67 ms
75,960 KB
testcase_12 AC 71 ms
76,568 KB
testcase_13 AC 66 ms
76,388 KB
testcase_14 AC 73 ms
76,524 KB
testcase_15 AC 73 ms
76,376 KB
testcase_16 AC 83 ms
78,632 KB
testcase_17 AC 103 ms
80,444 KB
testcase_18 AC 99 ms
77,704 KB
testcase_19 AC 198 ms
95,360 KB
testcase_20 AC 274 ms
103,500 KB
testcase_21 AC 66 ms
76,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.buffer.readline

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

S = set()
for bit in range(1<<N):
    if bin(bit).count("1") < K: continue
    p = 0
    m = 1
    for i, a in enumerate(A):
        if (1<<i)&bit:
            p += a
            m *= a
    S.add(p)
    S.add(m)

print(len(S))
0