結果

問題 No.1701 half price
ユーザー HydruHydru
提出日時 2021-10-08 22:10:14
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 404 bytes
コンパイル時間 766 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 77,816 KB
最終ジャッジ日時 2023-09-30 10:27:16
合計ジャッジ時間 3,652 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
71,732 KB
testcase_01 AC 95 ms
71,800 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 96 ms
71,608 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 96 ms
71,812 KB
testcase_10 AC 96 ms
71,340 KB
testcase_11 WA -
testcase_12 AC 96 ms
71,764 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 95 ms
71,536 KB
testcase_16 AC 97 ms
71,608 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 100 ms
71,540 KB
testcase_21 AC 112 ms
77,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

n,w=map(int,input().split())
A=list(map(int,input().split()))
ans=0
ind=deque()
for i in range(1<<n):
    sum=0
    cnt=0
    for j in range(n):
        if i & 1<<j:
            sum+=A[j]
            ind.append(j)
            cnt+=1
    if sum==w:
        ans+=1
    for k in range(cnt):
        x=ind.pop()
        if sum-A[x]//2==w:
            ans+=1
        
print(ans)
0