結果

問題 No.1701 half price
ユーザー kohei2019kohei2019
提出日時 2023-06-04 17:41:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 497 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 87,052 KB
実行使用メモリ 77,136 KB
最終ジャッジ日時 2023-08-28 08:17:43
合計ジャッジ時間 3,951 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,044 KB
testcase_01 AC 69 ms
71,148 KB
testcase_02 AC 108 ms
77,000 KB
testcase_03 AC 71 ms
71,000 KB
testcase_04 WA -
testcase_05 AC 78 ms
76,532 KB
testcase_06 AC 313 ms
77,032 KB
testcase_07 WA -
testcase_08 AC 70 ms
71,468 KB
testcase_09 AC 69 ms
71,392 KB
testcase_10 AC 69 ms
71,560 KB
testcase_11 AC 69 ms
71,184 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 70 ms
71,376 KB
testcase_16 AC 69 ms
71,168 KB
testcase_17 AC 156 ms
77,136 KB
testcase_18 AC 78 ms
76,416 KB
testcase_19 AC 83 ms
76,516 KB
testcase_20 AC 68 ms
71,212 KB
testcase_21 AC 328 ms
76,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,W = map(int,input().split())
lsA = list(map(int,input().split()))
ans = 0
for i in range(1,2**N):
    lsA0 = []
    for k in range(N):
        if (i>>k) & 1:
            lsA0.append(lsA[k])
    N2 = len(lsA0)
    flag = False
    for j in range(2**N2):
        cost = 0
        for k in range(N2):
            if (j>>k) & 1:
                cost += lsA[k]//2
            else:
                cost += lsA[k]
        if cost == W:
            flag = True
    if flag:
        ans += 1

print(ans)
0