結果

問題 No.1701 half price
ユーザー prd_xxxprd_xxx
提出日時 2021-10-08 23:44:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 468 bytes
コンパイル時間 246 ms
コンパイル使用メモリ 10,932 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-09-30 14:07:11
合計ジャッジ時間 6,793 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,956 KB
testcase_01 AC 16 ms
7,868 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ans = 0
for b in range(1<<N):
    s = 0
    for k in range(N):
        if b&(1<<k):
            s += A[k]
    if s== W:
        ans += 1
    i = b
    while i>0:
        j = b - i
        s = 0
        for k in range(N):
            if i&(1<<k):
                s += A[k]
            if j&(1<<k):
                s += A[k] // 2
        i = (i-1) & b
        if s == W:
            ans += 1
print(ans)
0