結果

問題 No.1701 half price
ユーザー prussian_coderprussian_coder
提出日時 2022-03-22 21:35:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 561 ms / 3,000 ms
コード長 360 bytes
コンパイル時間 251 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 76,692 KB
最終ジャッジ日時 2024-04-18 22:22:57
合計ジャッジ時間 3,779 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
51,712 KB
testcase_01 AC 48 ms
52,608 KB
testcase_02 AC 156 ms
76,032 KB
testcase_03 AC 43 ms
52,608 KB
testcase_04 AC 142 ms
76,040 KB
testcase_05 AC 73 ms
69,504 KB
testcase_06 AC 561 ms
76,288 KB
testcase_07 AC 555 ms
76,160 KB
testcase_08 AC 41 ms
51,712 KB
testcase_09 AC 43 ms
52,608 KB
testcase_10 AC 42 ms
52,352 KB
testcase_11 AC 39 ms
52,352 KB
testcase_12 AC 43 ms
52,096 KB
testcase_13 AC 42 ms
52,352 KB
testcase_14 AC 42 ms
51,968 KB
testcase_15 AC 41 ms
52,352 KB
testcase_16 AC 40 ms
51,712 KB
testcase_17 AC 92 ms
75,776 KB
testcase_18 AC 41 ms
52,516 KB
testcase_19 AC 50 ms
59,776 KB
testcase_20 AC 42 ms
52,352 KB
testcase_21 AC 537 ms
76,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
A=[int(x) for x in input().split()]
ans=0

def two(f):
	if f:
		return 2
	else:
		return 1

for i in range(1<<N):
	if i==0:
		continue
	flag=False
	X=[A[j] for j in range(N) if (i>>j)&1]
	M=len(X)
	for k in range(1<<M):
		if sum([X[j]//(two((k>>j)&1)) for j in range(M)])==K:
			flag=True
			break
	if flag:
		ans+=1
print(ans)
	
	
0