結果
| 問題 |
No.1701 half price
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-28 18:50:37 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 773 bytes |
| コンパイル時間 | 167 ms |
| コンパイル使用メモリ | 82,036 KB |
| 実行使用メモリ | 65,152 KB |
| 最終ジャッジ日時 | 2024-09-30 14:49:22 |
| 合計ジャッジ時間 | 2,267 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 2 |
| other | RE * 20 |
ソースコード
from itertools import product
from more_itertools import all_equal
def main():
N, W = map(int, input().split())
a = list(map(int, input().split()))
ctr = set()
for bit_3 in product(range(3), repeat=N):
if bit_3[0] == 0 and all_equal(bit_3):
continue
tmp_sum = 0
tmp_bit_n = 0
for idx, (bit, v) in enumerate(zip(bit_3, a)):
match bit:
case 0:
pass
case 1:
tmp_sum += v
tmp_bit_n += 2**idx
case 2:
tmp_sum += v // 2
tmp_bit_n += 2**idx
if tmp_sum == W:
ctr.add(tmp_bit_n)
print(len(ctr))
if __name__ == "__main__":
main()