結果

問題 No.1701 half price
ユーザー kohei2019kohei2019
提出日時 2023-06-04 17:31:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 480 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 87,232 KB
実行使用メモリ 76,868 KB
最終ジャッジ日時 2023-08-28 08:17:29
合計ジャッジ時間 2,989 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,456 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 76 ms
76,380 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 68 ms
71,020 KB
testcase_10 AC 69 ms
71,512 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 69 ms
71,124 KB
testcase_15 AC 70 ms
71,212 KB
testcase_16 AC 72 ms
71,044 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 71 ms
71,248 KB
testcase_21 AC 101 ms
76,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,W = map(int,input().split())
lsA = list(map(int,input().split()))
vals = set()
for i in range(N):
    lsA0 = lsA[:]
    lsA0[i] = lsA0[i]//2
    for j in range(2**N):
        cost = 0
        for k in range(N):
            if (j>>k) & 1:
                cost += lsA0[k]
        if cost == W:
            vals.add(j)
for j in range(2**N):
    cost = 0
    for k in range(N):
        if (j>>k) & 1:
            cost += lsA[k]
    if cost == W:
        vals.add(j)
print(len(vals))
0