結果

問題 No.1701 half price
コンテスト
ユーザー tktk_snsn
提出日時 2021-10-08 22:03:16
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
TLE  
実行時間 -
コード長 394 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,004 ms
コンパイル使用メモリ 20,832 KB
実行使用メモリ 15,484 KB
最終ジャッジ日時 2026-04-03 12:33:11
合計ジャッジ時間 6,741 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 4 TLE * 1 -- * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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 and buy != 0:
        ans.add(buy)

print(len(ans))
0