結果
| 問題 |
No.1861 Required Number
|
| コンテスト | |
| ユーザー |
brthyyjp
|
| 提出日時 | 2022-03-06 14:10:04 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 427 bytes |
| コンパイル時間 | 209 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 264,832 KB |
| 最終ジャッジ日時 | 2024-07-20 23:39:31 |
| 合計ジャッジ時間 | 6,717 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 WA * 16 TLE * 1 -- * 24 |
ソースコード
n, k = map(int, input().split())
A = list(map(int, input().split()))
from collections import Counter
C = Counter(A)
limit = (1<<k)-1
ans = 0
for a, v in C.items():
dp = 1
for b, u in C.items():
if a == b:
continue
for i in range(u):
dp |= dp<<b
if (dp>>k)&1:
continue
if (dp>>(k-a))&1 and v == 1:
ans += 1
if ans != 0:
print(ans)
else:
print(-1)
brthyyjp