結果

問題 No.1701 half price
ユーザー mesame3993mesame3993
提出日時 2021-10-08 23:03:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 497 bytes
コンパイル時間 682 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 82,996 KB
最終ジャッジ日時 2023-09-30 12:23:03
合計ジャッジ時間 6,186 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
71,168 KB
testcase_01 AC 74 ms
70,612 KB
testcase_02 AC 211 ms
78,524 KB
testcase_03 AC 77 ms
71,232 KB
testcase_04 WA -
testcase_05 AC 95 ms
75,896 KB
testcase_06 AC 816 ms
82,792 KB
testcase_07 WA -
testcase_08 AC 76 ms
70,952 KB
testcase_09 AC 75 ms
71,188 KB
testcase_10 AC 74 ms
71,188 KB
testcase_11 AC 76 ms
71,256 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 77 ms
71,260 KB
testcase_16 AC 75 ms
71,144 KB
testcase_17 AC 483 ms
79,672 KB
testcase_18 AC 96 ms
76,024 KB
testcase_19 AC 104 ms
76,736 KB
testcase_20 AC 76 ms
71,144 KB
testcase_21 AC 721 ms
82,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import product
n, w = map(int, input().split())
a = list(map(int, input().split()))
b = [i // 2 for i in a]
ans = 0
it = []
items = [i for i in range(n)]
for bits in product([0, 1], repeat=n):
	tmp = [[x] for x, bit in zip(items, bits) if bit == 1]
	if tmp == []:
		continue
	it.append(tmp)
for i in it:
	l = []
	for j in range(len(i)):
		l.append([a[j], b[j]])
	st = []
	for k in product(*l):
		k = sorted(k)
		if sum(k) == w and k not in st:
			st.append(k)
			ans += 1
print(ans)
0