結果
| 問題 |
No.1463 Hungry Kanten
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-02 21:46:52 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 432 ms / 2,000 ms |
| コード長 | 730 bytes |
| コンパイル時間 | 222 ms |
| コンパイル使用メモリ | 82,236 KB |
| 実行使用メモリ | 156,656 KB |
| 最終ジャッジ日時 | 2025-06-20 01:32:35 |
| 合計ジャッジ時間 | 3,968 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 |
ソースコード
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()