結果

問題 No.1701 half price
ユーザー titan23titan23
提出日時 2022-07-03 04:21:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 467 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 87,168 KB
実行使用メモリ 77,504 KB
最終ジャッジ日時 2023-08-19 00:09:41
合計ジャッジ時間 5,133 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
71,400 KB
testcase_01 AC 61 ms
76,700 KB
testcase_02 AC 124 ms
77,504 KB
testcase_03 AC 68 ms
76,484 KB
testcase_04 AC 126 ms
77,344 KB
testcase_05 AC 68 ms
76,600 KB
testcase_06 AC 708 ms
77,172 KB
testcase_07 AC 722 ms
77,360 KB
testcase_08 WA -
testcase_09 AC 60 ms
76,488 KB
testcase_10 AC 56 ms
71,476 KB
testcase_11 AC 64 ms
76,492 KB
testcase_12 AC 71 ms
76,496 KB
testcase_13 AC 61 ms
76,352 KB
testcase_14 AC 61 ms
76,520 KB
testcase_15 AC 62 ms
76,476 KB
testcase_16 AC 57 ms
71,360 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 62 ms
71,364 KB
testcase_21 AC 738 ms
77,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda: sys.stdin.readline().rstrip()

#  -----------------------  #

n, w = map(int, input().split())
A = list(map(int, input().split()))

if w == 0:
  exit(print(A.count(0)**2-1))

ans = set()
for i in range(3**n):
  tmp = 0
  buy = set()
  for j in range(n):
    if i%3 == 0:
      tmp += A[j]
      buy.add(j)
    elif i % 3 == 1:
      tmp += A[j] // 2
      buy.add(j)
    i //= 3

  if tmp == w:
    ans.add(frozenset(buy))

print(len(ans))
0