結果

問題 No.1701 half price
ユーザー rin204
提出日時 2021-10-13 18:54:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 575 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 82,116 KB
実行使用メモリ 75,788 KB
最終ジャッジ日時 2024-09-17 16:20:48
合計ジャッジ時間 3,139 ms
ジャッジサーバーID
(参考情報)
judge6 / 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 S in range(1 << n):
    T = S
    while T != 0:
        tot = 0
        for i in range(n):
            if S >> i & 1:
                if T >> i & 1:
                    tot += A[i] // 2
                else:
                    tot += A[i]
        if tot == w:
            ans += 1
            break
        T = (T - 1) & S
    else:
        tot = 0
        for i in range(n):
            if S >> i & 1:
                tot += A[i]
        if tot == w:
            ans += 1
    
    
print(ans)
0