結果
問題 | No.1463 Hungry Kanten |
ユーザー |
![]() |
提出日時 | 2021-04-02 21:30:42 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 303 ms / 2,000 ms |
コード長 | 512 bytes |
コンパイル時間 | 311 ms |
コンパイル使用メモリ | 82,244 KB |
実行使用メモリ | 130,416 KB |
最終ジャッジ日時 | 2025-06-20 01:30:54 |
合計ジャッジ時間 | 3,270 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 |
ソースコード
import sys input = sys.stdin.buffer.readline n, k = map(int, input().split()) A = list(map(int, input().split())) ans = set() popcnt = [0] * ((1 << n) + 10) for i in range(1 << n): popcnt[i] = popcnt[i // 2] + i % 2 if popcnt[i] >= k: goukei = 0 prod = 1 for j in range(n): if (i >> j) & 1: goukei += A[j] prod *= A[j] ans.add(goukei) ans.add(prod) # print(goukei) # print(prod) print(len(list(ans)))