結果

問題 No.1701 half price
ユーザー tktk_snsn
提出日時 2021-10-08 22:01:14
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 381 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 17,948 KB
最終ジャッジ日時 2024-07-23 04:15:12
合計ジャッジ時間 6,995 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 4 TLE * 1 -- * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

N, W = map(int, input().split())
A = list(map(int, input().split()))

ans = set()
for S in range(3 ** N):
    tot = 0
    buy = 0
    for i, a in enumerate(A):
        if S % 3 == 0:
            tot += a
            buy |= (1 << i)
        elif S % 3 == 1:
            tot += a // 2
            buy |= (1 << i)
        S //= 3
    if W == tot:
        ans.add(buy)

print(len(ans))
0