結果

問題 No.1463 Hungry Kanten
ユーザー lemonlemon
提出日時 2021-05-14 14:42:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,757 ms / 2,000 ms
コード長 553 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 31,212 KB
最終ジャッジ日時 2024-04-09 19:23:30
合計ジャッジ時間 8,189 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,752 KB
testcase_01 AC 25 ms
10,880 KB
testcase_02 AC 104 ms
11,520 KB
testcase_03 AC 1,709 ms
10,624 KB
testcase_04 AC 34 ms
10,624 KB
testcase_05 AC 1,757 ms
31,212 KB
testcase_06 AC 27 ms
10,752 KB
testcase_07 AC 25 ms
10,624 KB
testcase_08 AC 26 ms
10,752 KB
testcase_09 AC 25 ms
10,752 KB
testcase_10 AC 26 ms
10,624 KB
testcase_11 AC 28 ms
10,624 KB
testcase_12 AC 32 ms
10,880 KB
testcase_13 AC 35 ms
10,880 KB
testcase_14 AC 46 ms
11,008 KB
testcase_15 AC 63 ms
10,752 KB
testcase_16 AC 107 ms
11,776 KB
testcase_17 AC 203 ms
14,076 KB
testcase_18 AC 362 ms
11,520 KB
testcase_19 AC 829 ms
20,952 KB
testcase_20 AC 1,741 ms
30,296 KB
testcase_21 AC 29 ms
10,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()
ntp = lambda: tuple(map(int, stdin.readline().split()))
mod = 10 * 9 + 7
inf = 2 << 60

n, k = na()
A = na()

Ans = set()

for i in range(1 << n):
    sum = 0
    time = 1
    cnt = 0
    for j in range(n):
        if i & 1 << j:
            sum += A[j]
            time *= A[j]
            cnt += 1
    if cnt >= k:
        Ans.add(sum)
        Ans.add(time)

print(len(Ans))
0