結果

問題 No.1701 half price
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-10-08 22:12:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 385 bytes
コンパイル時間 1,435 ms
コンパイル使用メモリ 86,688 KB
実行使用メモリ 76,780 KB
最終ジャッジ日時 2023-09-30 10:30:06
合計ジャッジ時間 3,902 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
70,996 KB
testcase_01 AC 66 ms
70,788 KB
testcase_02 AC 102 ms
76,768 KB
testcase_03 AC 66 ms
71,016 KB
testcase_04 AC 97 ms
76,740 KB
testcase_05 AC 75 ms
76,128 KB
testcase_06 AC 263 ms
76,476 KB
testcase_07 AC 246 ms
76,396 KB
testcase_08 WA -
testcase_09 AC 70 ms
71,072 KB
testcase_10 AC 68 ms
70,948 KB
testcase_11 AC 67 ms
70,992 KB
testcase_12 AC 64 ms
70,568 KB
testcase_13 AC 67 ms
70,940 KB
testcase_14 AC 64 ms
70,852 KB
testcase_15 AC 67 ms
70,704 KB
testcase_16 AC 66 ms
71,060 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 66 ms
70,880 KB
testcase_21 AC 300 ms
76,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, w = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for b in range(1 << n):
	cnt = 0
	l = []
	for i in range(n):
		if b >> i & 1:
			cnt += a[i]
			l.append(a[i])
	f = False
	if cnt == w: f = True
	for b2 in range(1 << len(l)):
		cnt2 = cnt
		for i in range(len(l)):
			if b2 >> i & 1:
				cnt2 -= l[i] // 2
		if cnt2 == w: f = True; break
	ans += f
print(ans)
0