結果

問題 No.1701 half price
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-10-08 22:11:52
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 423 bytes
コンパイル時間 318 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 76,848 KB
最終ジャッジ日時 2023-09-30 10:29:34
合計ジャッジ時間 3,188 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,156 KB
testcase_01 AC 73 ms
70,700 KB
testcase_02 AC 95 ms
76,152 KB
testcase_03 AC 75 ms
70,568 KB
testcase_04 AC 97 ms
76,424 KB
testcase_05 AC 76 ms
70,972 KB
testcase_06 AC 96 ms
76,620 KB
testcase_07 AC 112 ms
76,640 KB
testcase_08 WA -
testcase_09 AC 74 ms
70,892 KB
testcase_10 AC 75 ms
70,564 KB
testcase_11 AC 75 ms
70,952 KB
testcase_12 AC 73 ms
70,940 KB
testcase_13 AC 73 ms
70,956 KB
testcase_14 AC 75 ms
70,984 KB
testcase_15 AC 73 ms
70,940 KB
testcase_16 AC 73 ms
71,032 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 73 ms
70,968 KB
testcase_21 AC 90 ms
76,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,w = map(int,input().split())
A = list(map(int,input().split()))
ans = 0

for i in range(1<<n):
    
    s = set()
    s.add(0)
    for j in range(n):
        if i >> j & 1:
            ns = set()
            for k in s:
                if k+A[j] <= w:
                    ns.add(k+A[j])
                if k+A[j]//2 <= w:
                    ns.add(k+A[j]//2)
            s = ns
    if w in s:
        ans += 1
print(ans)
0