結果

問題 No.1463 Hungry Kanten
ユーザー KudeKude
提出日時 2021-04-02 21:40:13
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 333 ms / 2,000 ms
コード長 299 bytes
コンパイル時間 360 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 122,968 KB
最終ジャッジ日時 2023-08-25 14:51:42
合計ジャッジ時間 4,226 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
71,236 KB
testcase_01 AC 58 ms
71,188 KB
testcase_02 AC 81 ms
78,280 KB
testcase_03 AC 273 ms
77,412 KB
testcase_04 AC 63 ms
76,296 KB
testcase_05 AC 333 ms
122,968 KB
testcase_06 AC 60 ms
71,564 KB
testcase_07 AC 57 ms
71,296 KB
testcase_08 AC 57 ms
71,232 KB
testcase_09 AC 59 ms
71,324 KB
testcase_10 AC 67 ms
76,756 KB
testcase_11 AC 69 ms
76,300 KB
testcase_12 AC 70 ms
76,984 KB
testcase_13 AC 66 ms
76,148 KB
testcase_14 AC 74 ms
77,028 KB
testcase_15 AC 74 ms
76,988 KB
testcase_16 AC 88 ms
78,828 KB
testcase_17 AC 111 ms
80,592 KB
testcase_18 AC 106 ms
78,272 KB
testcase_19 AC 212 ms
95,788 KB
testcase_20 AC 269 ms
103,760 KB
testcase_21 AC 71 ms
76,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
a = list(map(int, input().split()))
t = set()
for s in range(1 << n):
    if bin(s).count('1') < k:
        continue
    x = 0
    y = 1
    for d in range(n):
        if s >> d & 1:
            x += a[d]
            y *= a[d]
    t.add(x)
    t.add(y)
print(len(t))
0