結果

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

ソースコード

diff #

#import sys
# input = sys.stdin.readline
def mp():return map(int,input().split())
def lmp():return list(map(int,input().split()))
def mps(A):return [tuple(map(int, input().split())) for _ in range(A)]
import math
import bisect
import heapq
from copy import deepcopy as dc
from itertools import accumulate
from collections import Counter, defaultdict, deque
def ceil(U,V):return (U+V-1)//V
def modf1(N,MOD):return (N-1)%MOD+1
inf = int(1e20)
mod = 998244353

n,w = mp()
a = lmp()
ans = 0
for i in range(1<<n):
    cnt = 0
    lst = []
    for j in range(n):
        if i & 1<<j == 1<<j:
            cnt += a[j]
            lst.append(a[j]//2)
    if cnt < w:continue
    dif = cnt-w
    #print(lst,dif)
    flag = False
    for j in range(1<<len(lst)):
        c = 0
        for k in range(len(lst)):
            if j & 1<<k == 1<<k:
                c += lst[k]
        if c == dif:
            flag = True
    if flag:ans += 1

print(ans)
0