結果

問題 No.1701 half price
ユーザー lloyzlloyz
提出日時 2021-11-14 15:18:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 626 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 86,748 KB
実行使用メモリ 78,108 KB
最終ジャッジ日時 2023-08-19 22:02:38
合計ジャッジ時間 5,501 ms
ジャッジサーバーID
(参考情報)
judge14 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,152 KB
testcase_01 AC 79 ms
75,600 KB
testcase_02 AC 196 ms
77,448 KB
testcase_03 AC 75 ms
75,664 KB
testcase_04 AC 176 ms
77,572 KB
testcase_05 AC 97 ms
76,624 KB
testcase_06 AC 762 ms
77,164 KB
testcase_07 AC 744 ms
77,060 KB
testcase_08 WA -
testcase_09 AC 79 ms
75,648 KB
testcase_10 AC 71 ms
71,144 KB
testcase_11 AC 78 ms
75,716 KB
testcase_12 AC 77 ms
75,676 KB
testcase_13 AC 74 ms
75,808 KB
testcase_14 AC 76 ms
75,816 KB
testcase_15 AC 77 ms
75,860 KB
testcase_16 AC 72 ms
71,316 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 72 ms
71,008 KB
testcase_21 AC 694 ms
77,264 KB
権限があれば一括ダウンロードができます

ソースコード

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
        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