結果

問題 No.1701 half price
ユーザー tktk_snsntktk_snsn
提出日時 2021-10-08 22:03:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 394 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 10,688 KB
実行使用メモリ 12,468 KB
最終ジャッジ日時 2023-09-30 10:12:45
合計ジャッジ時間 6,527 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,896 KB
testcase_01 AC 17 ms
7,860 KB
testcase_02 AC 871 ms
7,900 KB
testcase_03 AC 16 ms
7,948 KB
testcase_04 AC 853 ms
7,996 KB
testcase_05 AC 23 ms
7,760 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます

ソースコード

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

print(len(ans))
0