結果

問題 No.1701 half price
ユーザー O2MTO2MT
提出日時 2021-10-08 22:17:15
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 465 bytes
コンパイル時間 522 ms
コンパイル使用メモリ 86,820 KB
実行使用メモリ 77,600 KB
最終ジャッジ日時 2023-09-30 10:39:11
合計ジャッジ時間 5,176 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
70,948 KB
testcase_01 AC 74 ms
70,892 KB
testcase_02 AC 172 ms
77,432 KB
testcase_03 AC 68 ms
70,948 KB
testcase_04 AC 171 ms
76,816 KB
testcase_05 AC 84 ms
76,284 KB
testcase_06 AC 746 ms
77,600 KB
testcase_07 AC 741 ms
77,336 KB
testcase_08 WA -
testcase_09 AC 71 ms
70,956 KB
testcase_10 AC 69 ms
70,872 KB
testcase_11 AC 72 ms
71,092 KB
testcase_12 AC 71 ms
71,172 KB
testcase_13 AC 71 ms
71,064 KB
testcase_14 AC 71 ms
70,872 KB
testcase_15 AC 71 ms
71,136 KB
testcase_16 AC 69 ms
71,064 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 69 ms
71,004 KB
testcase_21 AC 815 ms
77,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,W = map(int,input().split())
A = list(map(int,input().split()))
ans = 0

for i in range(2**N):
  bit = bin(i)[2:].zfill(N)
  B = []
  for j in range(N):
    if bit[j] == '1':
      B.append(A[j])
  M = len(B)
  flg = False
  for j in range(2**M):
    bit = bin(j)[2:].zfill(M)
    c = 0
    for k in range(M):
      if bit[k] == '1':
        c += B[k]//2
      else:
        c += B[k]
    if c == W:
      flg = True
      break
  if flg:
    ans += 1

print(ans)
0