結果

問題 No.1701 half price
ユーザー aaaaaaaaaa2230
提出日時 2021-10-08 22:11:52
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 423 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 82,448 KB
実行使用メモリ 76,016 KB
最終ジャッジ日時 2024-07-23 04:36:09
合計ジャッジ時間 1,924 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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(1<<n):
    
    s = set()
    s.add(0)
    for j in range(n):
        if i >> j & 1:
            ns = set()
            for k in s:
                if k+A[j] <= w:
                    ns.add(k+A[j])
                if k+A[j]//2 <= w:
                    ns.add(k+A[j]//2)
            s = ns
    if w in s:
        ans += 1
print(ans)
0