結果

問題 No.1463 Hungry Kanten
ユーザー moharan627moharan627
提出日時 2021-04-02 21:46:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 425 ms / 2,000 ms
コード長 730 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 87,332 KB
実行使用メモリ 160,636 KB
最終ジャッジ日時 2023-08-25 14:55:25
合計ジャッジ時間 4,736 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,452 KB
testcase_01 AC 91 ms
71,648 KB
testcase_02 AC 120 ms
79,896 KB
testcase_03 AC 265 ms
78,104 KB
testcase_04 AC 99 ms
77,428 KB
testcase_05 AC 425 ms
160,636 KB
testcase_06 AC 88 ms
71,672 KB
testcase_07 AC 86 ms
71,884 KB
testcase_08 AC 88 ms
71,756 KB
testcase_09 AC 87 ms
71,624 KB
testcase_10 AC 95 ms
77,512 KB
testcase_11 AC 101 ms
77,744 KB
testcase_12 AC 107 ms
78,156 KB
testcase_13 AC 103 ms
78,100 KB
testcase_14 AC 112 ms
78,144 KB
testcase_15 AC 108 ms
78,060 KB
testcase_16 AC 119 ms
81,132 KB
testcase_17 AC 136 ms
83,220 KB
testcase_18 AC 131 ms
79,560 KB
testcase_19 AC 246 ms
111,828 KB
testcase_20 AC 325 ms
126,492 KB
testcase_21 AC 101 ms
78,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LC(): return list(input())
def IC(): return [int(c) for c in input()]
def MI(): return map(int, sys.stdin.readline().split())
INF = float('inf')
def solve():
    N,K = MI()
    A = LI()
    from collections import defaultdict
    Num = defaultdict(lambda: 0)
    for i in range(2**N):
        Cook = []
        for j in range(N):
            if((i>>j) & 1):
                Cook.append(A[j])
        if(len(Cook)>=K):
            Num[sum(Cook)] = 1
            Tmp = 1
            for c in Cook:
                Tmp*=c
            Num[Tmp] = 1
    Ans = list(Num.keys())
    print(len(Ans))
    return
solve()
0