結果
問題 | No.1463 Hungry Kanten |
ユーザー |
![]() |
提出日時 | 2021-04-02 21:30:42 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 258 ms / 2,000 ms |
コード長 | 512 bytes |
コンパイル時間 | 420 ms |
コンパイル使用メモリ | 82,244 KB |
実行使用メモリ | 130,216 KB |
最終ジャッジ日時 | 2024-12-23 23:19:39 |
合計ジャッジ時間 | 2,986 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 |
ソースコード
import sysinput = sys.stdin.buffer.readlinen, 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 % 2if popcnt[i] >= k:goukei = 0prod = 1for 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)))