結果
問題 | No.1701 half price |
ユーザー |
![]() |
提出日時 | 2021-10-08 23:24:59 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 715 bytes |
コンパイル時間 | 192 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 21,660 KB |
最終ジャッジ日時 | 2024-07-23 07:25:37 |
合計ジャッジ時間 | 5,831 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 32 ms
17,820 KB |
testcase_01 | AC | 30 ms
10,880 KB |
testcase_02 | AC | 461 ms
12,160 KB |
testcase_03 | AC | 30 ms
10,752 KB |
testcase_04 | AC | 410 ms
12,160 KB |
testcase_05 | AC | 33 ms
10,752 KB |
testcase_06 | TLE | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
ソースコード
from itertools import product N,W = map(int,input().split()) A = list(map(int,input().split())) bit_lst = list(product([False, True], repeat=N)) goods_lst = [] for bits in bit_lst[1:]: goods = [] for i, bit in enumerate(bits): if bit: goods.append(A[i]) goods_lst.append(goods) # print(goods_lst) receipt = [] for goods, bits in zip(goods_lst, bit_lst[1:]): even_lst = list(product([False, True], repeat=len(goods))) # for l in range(len(goods)): # even_lst[l][l] = False # print(even_lst, goods) for evens in even_lst: yen = 0 for i, even in enumerate(evens): if even: yen += goods[i] else: yen += goods[i] // 2 if W == yen: receipt.append(bits) print(len(set(receipt)))