結果

問題 No.1701 half price
ユーザー playerplayer
提出日時 2024-01-16 02:49:33
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 469 bytes
コンパイル時間 360 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 339,420 KB
最終ジャッジ日時 2024-01-16 02:49:44
合計ジャッジ時間 10,201 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 45 ms
60,220 KB
testcase_02 AC 267 ms
102,992 KB
testcase_03 AC 43 ms
60,220 KB
testcase_04 AC 232 ms
102,992 KB
testcase_05 AC 62 ms
70,944 KB
testcase_06 AC 2,148 ms
339,420 KB
testcase_07 AC 2,002 ms
339,420 KB
testcase_08 WA -
testcase_09 AC 44 ms
60,220 KB
testcase_10 AC 37 ms
53,460 KB
testcase_11 AC 53 ms
60,220 KB
testcase_12 AC 44 ms
60,220 KB
testcase_13 AC 45 ms
60,220 KB
testcase_14 AC 44 ms
60,220 KB
testcase_15 AC 45 ms
60,220 KB
testcase_16 AC 37 ms
53,460 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 37 ms
53,460 KB
testcase_21 AC 1,904 ms
339,420 KB
権限があれば一括ダウンロードができます

ソースコード

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