結果

問題 No.1701 half price
ユーザー player
提出日時 2024-01-16 02:49:33
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 469 bytes
コンパイル時間 413 ms
コンパイル使用メモリ 82,816 KB
実行使用メモリ 339,848 KB
最終ジャッジ日時 2024-09-28 02:26:18
合計ジャッジ時間 8,423 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import *

n, w = map(int, input().split())
a = list(map(int, input().split()))
ans = 0

sequences = list(product([0, 0.5, 1], repeat=n))
used = set()
for seq in sequences:
    seq = list(seq)
    lis = []
    cost = 0
    for i in range(n):
        if seq[i] != 0:
            lis.append(i)
        cost += int(seq[i] * a[i])
    tup = tuple(lis)
    if tup in used:
        continue
    if cost == w:
        ans += 1
        used.add(tup)

print(ans)

0