結果

問題 No.1463 Hungry Kanten
ユーザー mkawa2mkawa2
提出日時 2021-04-02 21:42:17
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 1,603 ms / 2,000 ms
コード長 975 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 11,024 KB
実行使用メモリ 28,612 KB
最終ジャッジ日時 2023-08-25 14:52:48
合計ジャッジ時間 6,989 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,360 KB
testcase_01 AC 17 ms
8,200 KB
testcase_02 AC 71 ms
8,996 KB
testcase_03 AC 1,572 ms
8,368 KB
testcase_04 AC 17 ms
8,268 KB
testcase_05 AC 1,603 ms
28,612 KB
testcase_06 AC 16 ms
8,368 KB
testcase_07 AC 16 ms
8,284 KB
testcase_08 AC 16 ms
8,344 KB
testcase_09 AC 16 ms
8,280 KB
testcase_10 AC 17 ms
8,336 KB
testcase_11 AC 18 ms
8,328 KB
testcase_12 AC 20 ms
8,480 KB
testcase_13 AC 18 ms
8,264 KB
testcase_14 AC 33 ms
8,688 KB
testcase_15 AC 22 ms
8,260 KB
testcase_16 AC 72 ms
9,216 KB
testcase_17 AC 190 ms
11,604 KB
testcase_18 AC 84 ms
9,036 KB
testcase_19 AC 763 ms
18,284 KB
testcase_20 AC 1,049 ms
27,740 KB
testcase_21 AC 18 ms
8,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10**6)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.buffer.readline())
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def LI1(): return list(map(int1, sys.stdin.buffer.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def BI(): return sys.stdin.buffer.readline().rstrip()
def SI(): return sys.stdin.buffer.readline().rstrip().decode()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = 10**19
# md = 998244353
md = 10**9+7

popcnt=lambda x:bin(x).count("1")

n, k = LI()
aa = LI()
sm=set()

for bit in range(1<<n):
    if popcnt(bit)<k:continue
    s = 0
    m = 1
    for i in range(n):
        if bit>>i&1:
            s+=aa[i]
            m*=aa[i]
    sm.add(s)
    sm.add(m)

print(len(sm))
0