結果
| 問題 |
No.1463 Hungry Kanten
|
| コンテスト | |
| ユーザー |
Kiri8128
|
| 提出日時 | 2021-04-02 21:30:03 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 299 ms / 2,000 ms |
| コード長 | 477 bytes |
| コンパイル時間 | 204 ms |
| コンパイル使用メモリ | 82,484 KB |
| 実行使用メモリ | 113,344 KB |
| 最終ジャッジ日時 | 2025-06-20 01:30:44 |
| 合計ジャッジ時間 | 3,163 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 |
ソースコード
def popcount(x):
x -= (x >> 1) & 0x55555555
x = (x & 0x33333333) + ((x >> 2) & 0x33333333)
x = (x + (x >> 4)) & 0x0f0f0f0f
x += x >> 8
x += x >> 16
return x & 0x3f
N, K = map(int, input().split())
A = [int(a) for a in input().split()]
S = set()
for i in range(1 << N):
if popcount(i) < K: continue
s = 0
t = 1
for j, a in enumerate(A):
if i >> j & 1:
s += a
t *= a
S.add(s)
S.add(t)
print(len(S))
Kiri8128