結果

問題 No.1463 Hungry Kanten
ユーザー Navier_Boltzmann
提出日時 2023-11-12 08:26:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 516 ms / 2,000 ms
コード長 451 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 82,144 KB
実行使用メモリ 161,416 KB
最終ジャッジ日時 2025-06-20 01:53:54
合計ジャッジ時間 4,736 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import *
from itertools import *
from functools import *
from collections import *
import sys,math
input = sys.stdin.readline
import math
N,K = map(int,input().split())
A = list(map(int,input().split()))
X = []
for i in range(1<<N):
    
    if bin(i).count('1')<K:
        continue
    
    a = 0
    b = 1
    for j in range(N):
        if (i>>j)&1:
            a += A[j]
            b *= A[j]
    X += [a,b]
X = set(X)
print(len(X))
    
0