結果

問題 No.1701 half price
ユーザー Navier_Boltzmann
提出日時 2021-12-03 07:02:09
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 573 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 99,584 KB
最終ジャッジ日時 2024-07-05 10:54:49
合計ジャッジ時間 3,116 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

N,W = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
score = 0
cnd_list = []
cnd = []

def dfs(x):
    
    global score,ans,cnd,cnd_list
    
    if score == W:
        cnd_list.append(tuple(cnd))
        ans += 1
    
    if x == N:
        return
    
    if score > W:
        return
    
    

    dfs(x+1)
    
    
    score += a[x]//2
    cnd.append(x)
    dfs(x+1)
    cnd.remove(x)
    score -= a[x]//2

    
    score += a[x]
    cnd.append(x)
    dfs(x+1)
    cnd.remove(x)
    score -= a[x]
    
    return
dfs(0)
print(len(set(cnd_list)))
0