結果
問題 |
No.1701 half price
|
ユーザー |
|
提出日時 | 2021-11-14 15:20:04 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 710 bytes |
コンパイル時間 | 90 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 21,120 KB |
最終ジャッジ日時 | 2024-11-29 18:45:04 |
合計ジャッジ時間 | 20,036 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 16 TLE * 4 |
ソースコード
n, w = map(int, input().split()) A = list(map(int, input().split())) ans_set = set() for bit1 in range(1 << n): half_set = set() for i in range(n): if (bit1 >> i) & 1: half_set.add(i) for bit2 in range(1 << n): if (bit1 & bit2) != 0: continue if bit1 == 0 and bit2 == 0: continue not_half_set = set() for i in range(n): if (bit2 >> i) & 1: not_half_set.add(i) tmp = 0 for i in half_set: tmp += A[i] // 2 for i in not_half_set: tmp += A[i] if tmp == w: ans_set.add(bit1 + bit2) print(len(ans_set))