結果

問題 No.1701 half price
ユーザー DrDrpilotDrDrpilot
提出日時 2022-01-20 19:04:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 485 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 10,776 KB
実行使用メモリ 12,524 KB
最終ジャッジ日時 2023-08-15 18:18:15
合計ジャッジ時間 6,887 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
12,524 KB
testcase_01 AC 17 ms
8,128 KB
testcase_02 AC 579 ms
8,252 KB
testcase_03 AC 16 ms
8,120 KB
testcase_04 AC 551 ms
8,148 KB
testcase_05 AC 21 ms
8,292 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import product
n,w=map(int,input().split())
a=list(map(int,input().split()))
ans=set()
for bit in product(range(3),repeat=n):
    if sum(bit)==0:
        continue
    tmp=0
    for i in range(n):
        if bit[i]==1:
            tmp+=a[i]
        elif bit[i]==2:
            tmp+=a[i]//2
    if tmp==w:
        sel=[]
        for i in range(n):
            if bit[i]!=0:
                sel.append(i)
        sel=tuple(sel)
        ans.add(sel)
print(len(ans))
        
0