結果
| 問題 | 
                            No.1701 half price
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-01-20 19:04:35 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 485 bytes | 
| コンパイル時間 | 95 ms | 
| コンパイル使用メモリ | 12,416 KB | 
| 実行使用メモリ | 21,376 KB | 
| 最終ジャッジ日時 | 2024-11-24 02:22:52 | 
| 合計ジャッジ時間 | 17,677 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 17 TLE * 3 | 
ソースコード
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))