結果

問題 No.1463 Hungry Kanten
ユーザー lloyzlloyz
提出日時 2022-03-14 21:14:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 214 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 1,374 ms
コンパイル使用メモリ 81,808 KB
実行使用メモリ 113,496 KB
最終ジャッジ日時 2023-10-21 08:21:49
合計ジャッジ時間 2,835 ms
ジャッジサーバーID
(参考情報)
judge13 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,352 KB
testcase_01 AC 33 ms
53,352 KB
testcase_02 AC 50 ms
68,560 KB
testcase_03 AC 137 ms
75,176 KB
testcase_04 AC 34 ms
53,352 KB
testcase_05 AC 214 ms
113,496 KB
testcase_06 AC 32 ms
53,352 KB
testcase_07 AC 34 ms
53,352 KB
testcase_08 AC 32 ms
53,352 KB
testcase_09 AC 32 ms
53,352 KB
testcase_10 AC 32 ms
53,352 KB
testcase_11 AC 35 ms
59,448 KB
testcase_12 AC 42 ms
59,660 KB
testcase_13 AC 42 ms
59,728 KB
testcase_14 AC 54 ms
66,088 KB
testcase_15 AC 43 ms
59,736 KB
testcase_16 AC 49 ms
68,968 KB
testcase_17 AC 66 ms
80,336 KB
testcase_18 AC 49 ms
68,372 KB
testcase_19 AC 120 ms
90,192 KB
testcase_20 AC 156 ms
97,140 KB
testcase_21 AC 38 ms
59,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import combinations

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

ANS = set()
for r in range(k, n + 1):
    for C in combinations(range(n), r):
        add_temp = 0
        product_temp = 1
        for idx in C:
            add_temp += A[idx]
            product_temp *= A[idx]
        ANS.add(add_temp)
        ANS.add(product_temp)
print(len(ANS))
0