結果

問題 No.1701 half price
ユーザー tktk_snsntktk_snsn
提出日時 2021-10-08 22:03:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 583 ms / 3,000 ms
コード長 394 bytes
コンパイル時間 1,200 ms
コンパイル使用メモリ 86,540 KB
実行使用メモリ 76,828 KB
最終ジャッジ日時 2023-09-30 10:13:22
合計ジャッジ時間 5,519 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,312 KB
testcase_01 AC 78 ms
76,060 KB
testcase_02 AC 125 ms
76,224 KB
testcase_03 AC 75 ms
76,208 KB
testcase_04 AC 113 ms
76,056 KB
testcase_05 AC 80 ms
75,920 KB
testcase_06 AC 583 ms
76,412 KB
testcase_07 AC 569 ms
76,660 KB
testcase_08 AC 69 ms
71,288 KB
testcase_09 AC 73 ms
76,096 KB
testcase_10 AC 69 ms
71,292 KB
testcase_11 AC 71 ms
75,968 KB
testcase_12 AC 72 ms
75,980 KB
testcase_13 AC 73 ms
75,764 KB
testcase_14 AC 72 ms
76,252 KB
testcase_15 AC 72 ms
76,080 KB
testcase_16 AC 70 ms
71,068 KB
testcase_17 AC 201 ms
76,304 KB
testcase_18 AC 79 ms
76,076 KB
testcase_19 AC 82 ms
76,208 KB
testcase_20 AC 70 ms
70,872 KB
testcase_21 AC 562 ms
76,828 KB
権限があれば一括ダウンロードができます

ソースコード

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