結果

問題 No.1701 half price
ユーザー lloyzlloyz
提出日時 2021-11-14 15:17:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 619 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 87,268 KB
実行使用メモリ 77,992 KB
最終ジャッジ日時 2023-08-19 22:00:23
合計ジャッジ時間 6,107 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,228 KB
testcase_01 AC 97 ms
75,308 KB
testcase_02 AC 199 ms
77,488 KB
testcase_03 AC 102 ms
75,892 KB
testcase_04 AC 201 ms
77,300 KB
testcase_05 AC 98 ms
76,460 KB
testcase_06 AC 758 ms
76,992 KB
testcase_07 AC 737 ms
77,280 KB
testcase_08 WA -
testcase_09 AC 77 ms
75,596 KB
testcase_10 AC 74 ms
71,096 KB
testcase_11 AC 78 ms
75,636 KB
testcase_12 AC 77 ms
75,496 KB
testcase_13 AC 77 ms
75,620 KB
testcase_14 AC 76 ms
75,556 KB
testcase_15 AC 77 ms
75,572 KB
testcase_16 AC 70 ms
70,996 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 75 ms
71,212 KB
testcase_21 AC 681 ms
77,244 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:
            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