結果

問題 No.1701 half price
ユーザー brthyyjpbrthyyjp
提出日時 2021-10-08 22:11:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 454 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 87,268 KB
実行使用メモリ 77,440 KB
最終ジャッジ日時 2023-09-30 10:28:15
合計ジャッジ時間 4,859 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
70,492 KB
testcase_01 AC 80 ms
76,344 KB
testcase_02 AC 120 ms
76,644 KB
testcase_03 AC 81 ms
76,104 KB
testcase_04 AC 118 ms
76,664 KB
testcase_05 AC 82 ms
76,340 KB
testcase_06 AC 573 ms
76,532 KB
testcase_07 AC 578 ms
76,472 KB
testcase_08 WA -
testcase_09 AC 78 ms
75,972 KB
testcase_10 AC 77 ms
71,000 KB
testcase_11 AC 79 ms
76,104 KB
testcase_12 AC 81 ms
75,684 KB
testcase_13 AC 79 ms
75,972 KB
testcase_14 AC 80 ms
75,568 KB
testcase_15 AC 84 ms
76,088 KB
testcase_16 AC 81 ms
70,824 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 74 ms
70,908 KB
testcase_21 AC 553 ms
76,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, w = map(int, input().split())
A =list(map(int, input().split()))
ans = 0
import itertools
used = set()
for p in itertools.product(range(3), repeat=n):
    s = 0
    t = 0
    for j in range(n):
        if p[j] == 0:
            continue
        elif p[j] == 1:
            s += A[j]
            t |= (1<<j)
        else:
            s += A[j]//2
            t |= (1<<j)
    if s == w and t not in used:
        ans += 1
        used.add(t)
print(ans)
0