結果

問題 No.1701 half price
ユーザー flippergo
提出日時 2024-12-21 19:55:52
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 592 bytes
コンパイル時間 490 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 76,260 KB
最終ジャッジ日時 2024-12-21 19:55:56
合計ジャッジ時間 3,109 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

N,W = map(int,input().split())
A = list(map(int,input().split()))
ans = set()
for i in range(1<<N):
    B = A[:]
    cnt = 0
    ind = []
    for k in range(N):
        if (i>>k)&1:
            cnt += B[k]
            ind.append(k)
    if cnt==W:
        ans.add(i)
    elif cnt>W:
        for j in range(1<<len(ind)):
            cnt = 0
            for k in range(len(ind)):
                if (j>>k)&1:
                    cnt += B[ind[k]]//2
                else:
                    cnt += B[ind[k]]
            if cnt==W:
                ans.add(i)
                break
print(len(ans))
0