結果
| 問題 |
No.1701 half price
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-01-20 19:04:53 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 477 ms / 3,000 ms |
| コード長 | 485 bytes |
| コンパイル時間 | 342 ms |
| コンパイル使用メモリ | 82,532 KB |
| 実行使用メモリ | 76,928 KB |
| 最終ジャッジ日時 | 2024-11-24 02:23:50 |
| 合計ジャッジ時間 | 3,883 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 |
ソースコード
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))