結果

問題 No.1701 half price
ユーザー 👑 rin204rin204
提出日時 2021-10-13 18:54:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 575 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 81,740 KB
実行使用メモリ 75,444 KB
最終ジャッジ日時 2023-10-17 19:09:33
合計ジャッジ時間 4,262 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,416 KB
testcase_01 AC 38 ms
53,416 KB
testcase_02 AC 81 ms
72,372 KB
testcase_03 AC 38 ms
53,416 KB
testcase_04 AC 81 ms
72,376 KB
testcase_05 AC 47 ms
61,980 KB
testcase_06 AC 457 ms
75,400 KB
testcase_07 AC 329 ms
75,444 KB
testcase_08 WA -
testcase_09 AC 42 ms
59,904 KB
testcase_10 AC 38 ms
53,416 KB
testcase_11 AC 38 ms
53,416 KB
testcase_12 AC 38 ms
53,416 KB
testcase_13 AC 38 ms
53,416 KB
testcase_14 AC 39 ms
53,416 KB
testcase_15 AC 42 ms
59,904 KB
testcase_16 AC 38 ms
53,416 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 37 ms
53,416 KB
testcase_21 AC 460 ms
75,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, w = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
for S in range(1 << n):
    T = S
    while T != 0:
        tot = 0
        for i in range(n):
            if S >> i & 1:
                if T >> i & 1:
                    tot += A[i] // 2
                else:
                    tot += A[i]
        if tot == w:
            ans += 1
            break
        T = (T - 1) & S
    else:
        tot = 0
        for i in range(n):
            if S >> i & 1:
                tot += A[i]
        if tot == w:
            ans += 1
    
    
print(ans)
0