結果

問題 No.1701 half price
ユーザー sasa8uyauya
提出日時 2024-08-08 19:59:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 687 ms / 3,000 ms
コード長 268 bytes
コンパイル時間 298 ms
コンパイル使用メモリ 82,264 KB
実行使用メモリ 77,072 KB
最終ジャッジ日時 2024-08-08 19:59:18
合計ジャッジ時間 5,044 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

n,w=map(int,input().split())
a=list(map(int,input().split()))
c=0
for i in range(1,1<<n):
  b=[a[j] for j in range(n) if (i>>j)&1]
  B=sum(b)
  f=0
  m=len(b)
  for ii in range(1<<m):
    bb=sum(b[jj]//2 for jj in range(m) if (ii>>jj)&1)
    f|=B-bb==w
  c+=f
print(c)
0