結果

問題 No.1701 half price
ユーザー Hydru
提出日時 2021-10-08 22:10:14
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 404 bytes
コンパイル時間 396 ms
コンパイル使用メモリ 82,556 KB
実行使用メモリ 66,800 KB
最終ジャッジ日時 2024-07-23 04:34:01
合計ジャッジ時間 2,109 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 8 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

n,w=map(int,input().split())
A=list(map(int,input().split()))
ans=0
ind=deque()
for i in range(1<<n):
    sum=0
    cnt=0
    for j in range(n):
        if i & 1<<j:
            sum+=A[j]
            ind.append(j)
            cnt+=1
    if sum==w:
        ans+=1
    for k in range(cnt):
        x=ind.pop()
        if sum-A[x]//2==w:
            ans+=1
        
print(ans)
0