結果

問題 No.1701 half price
ユーザー O2MT
提出日時 2021-10-08 22:13:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 465 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 82,452 KB
実行使用メモリ 76,288 KB
最終ジャッジ日時 2024-07-23 04:39:41
合計ジャッジ時間 4,152 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

N,W = map(int,input().split())
A = list(map(int,input().split()))
ans = 0

for i in range(2**N):
  bit = bin(i)[2:].zfill(N)
  B = []
  for j in range(N):
    if bit[j] == '1':
      B.append(A[j])
  M = len(B)
  flg = False
  for j in range(2**M):
    bit = bin(j)[2:].zfill(M)
    c = 0
    for j in range(M):
      if bit[j] == '1':
        c += B[j]//2
      else:
        c += B[j]
    if c == W:
      flg = True
      break
  if flg:
    ans += 1

print(ans)
0