結果

問題 No.1463 Hungry Kanten
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2023-11-12 08:26:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 493 ms / 2,000 ms
コード長 451 bytes
コンパイル時間 1,056 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 160,892 KB
最終ジャッジ日時 2023-11-12 08:26:25
合計ジャッジ時間 4,648 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
55,720 KB
testcase_01 AC 44 ms
55,720 KB
testcase_02 AC 80 ms
77,836 KB
testcase_03 AC 486 ms
125,272 KB
testcase_04 AC 50 ms
64,268 KB
testcase_05 AC 493 ms
160,892 KB
testcase_06 AC 44 ms
55,720 KB
testcase_07 AC 45 ms
55,720 KB
testcase_08 AC 44 ms
55,720 KB
testcase_09 AC 44 ms
55,720 KB
testcase_10 AC 52 ms
64,568 KB
testcase_11 AC 55 ms
66,140 KB
testcase_12 AC 60 ms
68,864 KB
testcase_13 AC 55 ms
66,532 KB
testcase_14 AC 65 ms
72,980 KB
testcase_15 AC 63 ms
72,964 KB
testcase_16 AC 80 ms
78,104 KB
testcase_17 AC 128 ms
83,068 KB
testcase_18 AC 98 ms
77,200 KB
testcase_19 AC 264 ms
112,572 KB
testcase_20 AC 376 ms
125,864 KB
testcase_21 AC 53 ms
64,704 KB
権限があれば一括ダウンロードができます

ソースコード

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