結果
| 問題 | No.1463 Hungry Kanten |
| コンテスト | |
| ユーザー |
rlangevin
|
| 提出日時 | 2023-01-01 21:43:27 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 200 ms / 2,000 ms |
| + 26µs | |
| コード長 | 399 bytes |
| 記録 | |
| コンパイル時間 | 134 ms |
| コンパイル使用メモリ | 64,744 KB |
| 実行使用メモリ | 94,088 KB |
| 最終ジャッジ日時 | 2026-10-15 13:51:24 |
| 合計ジャッジ時間 | 3,847 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 |
ソースコード
def popcount(n):
cnt = 0
while n:
cnt += n & 1
n //= 2
return cnt
N, K = map(int, input().split())
A = list(map(int, input().split()))
SS = set()
for i in range(1 << N):
if popcount(i) < K:
continue
S = 0
P = 1
for j in range(N):
if (i >> j) & 1:
S += A[j]
P *= A[j]
SS.add(S)
SS.add(P)
print(len(SS))
rlangevin