結果
問題 | No.1701 half price |
ユーザー |
![]() |
提出日時 | 2021-10-08 22:13:41 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 547 ms / 3,000 ms |
コード長 | 486 bytes |
コンパイル時間 | 323 ms |
コンパイル使用メモリ | 82,580 KB |
実行使用メモリ | 76,144 KB |
最終ジャッジ日時 | 2024-07-23 04:39:46 |
合計ジャッジ時間 | 3,611 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 |
ソースコード
n, w = map(int, input().split()) A =list(map(int, input().split())) ans = 0 import itertools used = set() for p in itertools.product(range(3), repeat=n): s = 0 t = 0 for j in range(n): if p[j] == 0: continue elif p[j] == 1: s += A[j] t |= (1<<j) else: s += A[j]//2 t |= (1<<j) if t == 0: continue if s == w and t not in used: ans += 1 used.add(t) print(ans)