結果

問題 No.1701 half price
ユーザー tassei903tassei903
提出日時 2021-10-08 22:18:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 569 ms / 3,000 ms
コード長 723 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 82,372 KB
実行使用メモリ 76,336 KB
最終ジャッジ日時 2024-07-23 04:47:03
合計ジャッジ時間 3,623 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
sys.setrecursionlimit(10**7)
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
from itertools import product
n,w = na()
a = na()
c = set()
for i in product(range(3), repeat  = n):
    s = 0
    d = 0
    for j in range(n):
        if i[j]>0:
            d+=1<<j
        if i[j]==1:
            s+=a[j]//2
        if i[j]==2:
            s+=a[j]
    if d==0:
        continue
    if s==w:
        c.add(d)

print(len(c))
0