結果

問題 No.1701 half price
ユーザー 👑 KazunKazun
提出日時 2021-10-08 22:00:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 562 ms / 3,000 ms
コード長 358 bytes
コンパイル時間 377 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 76,436 KB
最終ジャッジ日時 2023-09-30 10:07:13
合計ジャッジ時間 4,825 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
70,552 KB
testcase_01 AC 77 ms
75,616 KB
testcase_02 AC 122 ms
75,512 KB
testcase_03 AC 76 ms
75,744 KB
testcase_04 AC 119 ms
75,744 KB
testcase_05 AC 82 ms
76,180 KB
testcase_06 AC 562 ms
76,120 KB
testcase_07 AC 562 ms
76,116 KB
testcase_08 AC 72 ms
70,868 KB
testcase_09 AC 77 ms
75,696 KB
testcase_10 AC 73 ms
70,540 KB
testcase_11 AC 77 ms
75,788 KB
testcase_12 AC 75 ms
75,912 KB
testcase_13 AC 77 ms
75,896 KB
testcase_14 AC 76 ms
75,660 KB
testcase_15 AC 76 ms
75,720 KB
testcase_16 AC 72 ms
70,828 KB
testcase_17 AC 202 ms
76,436 KB
testcase_18 AC 81 ms
76,212 KB
testcase_19 AC 83 ms
75,912 KB
testcase_20 AC 72 ms
70,804 KB
testcase_21 AC 546 ms
76,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

S=set()

for T in range(3**N):
    alpha=0
    beta=0

    for i in range(N):
        if T%3==0:
            alpha+=A[i]
            beta+=1<<i
        elif T%3==1:
            alpha+=A[i]//2
            beta+=1<<i

        T//=3

    if alpha==W and beta>0:
        S.add(beta)

print(len(S))
0