結果

問題 No.1701 half price
ユーザー lloyzlloyz
提出日時 2021-11-14 15:20:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 710 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 10,932 KB
実行使用メモリ 12,656 KB
最終ジャッジ日時 2023-08-19 22:06:07
合計ジャッジ時間 7,218 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
12,244 KB
testcase_01 AC 17 ms
7,784 KB
testcase_02 AC 1,137 ms
7,780 KB
testcase_03 AC 17 ms
7,856 KB
testcase_04 AC 1,082 ms
7,796 KB
testcase_05 AC 22 ms
7,844 KB
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_set = set()
for bit1 in range(1 << n):
    half_set = set()
    for i in range(n):
        if (bit1 >> i) & 1:
            half_set.add(i)
    for bit2 in range(1 << n):
        if (bit1 & bit2) != 0:
            continue
        if bit1 == 0 and bit2 == 0:
            continue
        not_half_set = set()
        for i in range(n):
            if (bit2 >> i) & 1:
                not_half_set.add(i)
        tmp = 0
        for i in half_set:
            tmp += A[i] // 2
        for i in not_half_set:
            tmp += A[i]
        if tmp == w:
            ans_set.add(bit1 + bit2)
print(len(ans_set))

0