結果

問題 No.1701 half price
ユーザー mesame3993mesame3993
提出日時 2021-10-08 23:18:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 509 bytes
コンパイル時間 905 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 83,304 KB
最終ジャッジ日時 2023-09-30 13:09:36
合計ジャッジ時間 6,462 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,456 KB
testcase_01 AC 75 ms
71,260 KB
testcase_02 AC 206 ms
79,084 KB
testcase_03 AC 75 ms
71,472 KB
testcase_04 AC 185 ms
78,940 KB
testcase_05 AC 91 ms
76,412 KB
testcase_06 AC 802 ms
82,772 KB
testcase_07 WA -
testcase_08 AC 73 ms
71,224 KB
testcase_09 AC 76 ms
71,504 KB
testcase_10 AC 74 ms
71,268 KB
testcase_11 AC 75 ms
71,380 KB
testcase_12 AC 76 ms
71,580 KB
testcase_13 AC 76 ms
71,128 KB
testcase_14 AC 74 ms
71,352 KB
testcase_15 AC 76 ms
71,380 KB
testcase_16 AC 75 ms
71,304 KB
testcase_17 AC 501 ms
80,008 KB
testcase_18 AC 98 ms
76,156 KB
testcase_19 AC 103 ms
77,408 KB
testcase_20 AC 77 ms
71,100 KB
testcase_21 AC 725 ms
83,120 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[i[j][0]], b[i[j][0]]])
	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