結果

問題 No.1701 half price
ユーザー mesame3993mesame3993
提出日時 2021-10-08 23:18:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 509 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 81,904 KB
実行使用メモリ 82,040 KB
最終ジャッジ日時 2024-07-23 07:09:56
合計ジャッジ時間 4,730 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,444 KB
testcase_01 AC 40 ms
53,540 KB
testcase_02 AC 161 ms
77,572 KB
testcase_03 AC 39 ms
53,684 KB
testcase_04 AC 153 ms
77,500 KB
testcase_05 AC 54 ms
66,204 KB
testcase_06 AC 797 ms
82,040 KB
testcase_07 WA -
testcase_08 AC 37 ms
53,412 KB
testcase_09 AC 38 ms
53,140 KB
testcase_10 AC 36 ms
53,208 KB
testcase_11 AC 38 ms
53,504 KB
testcase_12 AC 38 ms
53,488 KB
testcase_13 AC 37 ms
53,544 KB
testcase_14 AC 38 ms
54,020 KB
testcase_15 AC 37 ms
53,712 KB
testcase_16 AC 37 ms
52,572 KB
testcase_17 AC 460 ms
79,348 KB
testcase_18 AC 59 ms
69,464 KB
testcase_19 AC 71 ms
75,896 KB
testcase_20 AC 39 ms
53,280 KB
testcase_21 AC 682 ms
81,772 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