結果

問題 No.1701 half price
ユーザー ああいいああいい
提出日時 2022-01-10 00:05:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 552 ms / 3,000 ms
コード長 460 bytes
コンパイル時間 562 ms
コンパイル使用メモリ 86,968 KB
実行使用メモリ 77,104 KB
最終ジャッジ日時 2023-08-09 05:00:06
合計ジャッジ時間 4,776 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,504 KB
testcase_01 AC 73 ms
76,656 KB
testcase_02 AC 109 ms
76,364 KB
testcase_03 AC 73 ms
76,424 KB
testcase_04 AC 109 ms
76,292 KB
testcase_05 AC 77 ms
76,504 KB
testcase_06 AC 543 ms
76,968 KB
testcase_07 AC 552 ms
76,960 KB
testcase_08 AC 68 ms
71,516 KB
testcase_09 AC 74 ms
76,484 KB
testcase_10 AC 69 ms
71,396 KB
testcase_11 AC 73 ms
76,312 KB
testcase_12 AC 76 ms
76,540 KB
testcase_13 AC 73 ms
76,408 KB
testcase_14 AC 74 ms
76,460 KB
testcase_15 AC 74 ms
76,488 KB
testcase_16 AC 69 ms
71,512 KB
testcase_17 AC 186 ms
77,104 KB
testcase_18 AC 78 ms
76,268 KB
testcase_19 AC 79 ms
76,596 KB
testcase_20 AC 69 ms
71,112 KB
testcase_21 AC 527 ms
76,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ans = set()
for bit in range(3 ** N):
    nedan = 0
    b = 0
    for j in range(N):
        if bit % 3 == 0:
            pass
        elif bit % 3 == 1:
            nedan += a[j]
            b ^= (1 << j)
        else:
            nedan += a[j] // 2
            b ^= (1 << j)
        bit //= 3
    if nedan == W:
        ans.add(b)
if W == 0:count = -1
else:count = 0
print(len(ans) + count)
0