結果

問題 No.1701 half price
ユーザー vwxyzvwxyz
提出日時 2021-10-08 22:23:33
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 463 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 86,624 KB
実行使用メモリ 77,152 KB
最終ジャッジ日時 2023-09-30 10:48:59
合計ジャッジ時間 4,739 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
70,736 KB
testcase_01 AC 77 ms
71,108 KB
testcase_02 AC 149 ms
77,040 KB
testcase_03 AC 76 ms
71,036 KB
testcase_04 AC 146 ms
76,692 KB
testcase_05 AC 90 ms
76,372 KB
testcase_06 AC 553 ms
76,944 KB
testcase_07 AC 552 ms
76,820 KB
testcase_08 WA -
testcase_09 AC 76 ms
71,196 KB
testcase_10 AC 77 ms
71,012 KB
testcase_11 AC 78 ms
70,700 KB
testcase_12 AC 78 ms
71,020 KB
testcase_13 AC 76 ms
70,896 KB
testcase_14 AC 77 ms
71,032 KB
testcase_15 AC 77 ms
70,952 KB
testcase_16 AC 76 ms
71,084 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 78 ms
70,808 KB
testcase_21 AC 624 ms
77,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline

N,W=map(int,readline().split())
A=list(map(int,readline().split()))
ans=0
for bit in range(1<<N):
    lst=[A[i] for i in range(N) if bit>>i&1]
    l=len(lst)
    for bit in range(1<<l):
        price=[]
        for i in range(l):
            if bit>>i&1:
                price.append(lst[i]//2)
            else:
                price.append(lst[i])
        if sum(price)==W:
            ans+=1
            break
print(ans)
0