結果

問題 No.1701 half price
ユーザー titiatitia
提出日時 2021-10-08 22:17:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 127 ms / 3,000 ms
コード長 431 bytes
コンパイル時間 251 ms
コンパイル使用メモリ 86,884 KB
実行使用メモリ 77,232 KB
最終ジャッジ日時 2023-09-30 10:39:05
合計ジャッジ時間 2,983 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,200 KB
testcase_01 AC 69 ms
71,404 KB
testcase_02 AC 86 ms
76,484 KB
testcase_03 AC 69 ms
71,320 KB
testcase_04 AC 91 ms
77,124 KB
testcase_05 AC 75 ms
75,844 KB
testcase_06 AC 101 ms
76,892 KB
testcase_07 AC 127 ms
76,976 KB
testcase_08 AC 70 ms
71,372 KB
testcase_09 AC 68 ms
71,208 KB
testcase_10 AC 70 ms
71,248 KB
testcase_11 AC 70 ms
71,148 KB
testcase_12 AC 69 ms
71,156 KB
testcase_13 AC 67 ms
71,204 KB
testcase_14 AC 70 ms
71,324 KB
testcase_15 AC 67 ms
71,356 KB
testcase_16 AC 70 ms
71,408 KB
testcase_17 AC 71 ms
71,324 KB
testcase_18 AC 69 ms
71,196 KB
testcase_19 AC 68 ms
71,424 KB
testcase_20 AC 69 ms
71,348 KB
testcase_21 AC 83 ms
77,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,W=map(int,input().split())
A=list(map(int,input().split()))
ANS=0

if W==0:
    X=0
    for a in A:
        if a==0:
            X+=1
    print(pow(2,X)-1)
    exit()


for j in range(1<<N):
    sc={0}

    for k in range(N):
        AD=[]
        if j & (1<<k)!=0:
            for x in sc:
                AD.append(x+A[k])
                AD.append(x+A[k]//2)
            sc=set(AD)

    if W in sc:
        ANS+=1

print(ANS)
0