結果

問題 No.1701 half price
ユーザー tnodinotnodino
提出日時 2022-05-24 21:26:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 493 ms / 3,000 ms
コード長 434 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 81,696 KB
実行使用メモリ 75,556 KB
最終ジャッジ日時 2023-10-20 18:56:20
合計ジャッジ時間 3,320 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,404 KB
testcase_01 AC 40 ms
59,928 KB
testcase_02 AC 75 ms
70,392 KB
testcase_03 AC 39 ms
59,928 KB
testcase_04 AC 78 ms
70,392 KB
testcase_05 AC 47 ms
62,200 KB
testcase_06 AC 493 ms
75,396 KB
testcase_07 AC 490 ms
75,480 KB
testcase_08 AC 32 ms
53,404 KB
testcase_09 AC 39 ms
59,928 KB
testcase_10 AC 33 ms
53,404 KB
testcase_11 AC 39 ms
59,928 KB
testcase_12 AC 39 ms
59,928 KB
testcase_13 AC 38 ms
59,928 KB
testcase_14 AC 38 ms
59,928 KB
testcase_15 AC 42 ms
59,928 KB
testcase_16 AC 35 ms
53,404 KB
testcase_17 AC 152 ms
75,556 KB
testcase_18 AC 44 ms
62,264 KB
testcase_19 AC 47 ms
62,268 KB
testcase_20 AC 34 ms
53,404 KB
testcase_21 AC 470 ms
75,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,W = map(int,input().split())
a = list(map(int,input().split()))
ans = set()
for bit in range(1,3**N):
    ret = 0
    x = bit
    b = 0
    for i in range(N):
        if x % 3 == 0:
            pass
        else:
            if x % 3 == 2:
                ret += a[i] // 2
            elif x % 3 == 1:
                ret += a[i]
            b += 1
        x //= 3
        b <<= 1
    if ret == W:
        ans.add(b)
print(len(ans))
0