結果

問題 No.1701 half price
ユーザー O2MTO2MT
提出日時 2021-10-08 22:13:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 465 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 86,776 KB
実行使用メモリ 77,640 KB
最終ジャッジ日時 2023-09-30 10:32:47
合計ジャッジ時間 4,903 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,440 KB
testcase_01 AC 66 ms
71,296 KB
testcase_02 AC 174 ms
77,516 KB
testcase_03 AC 71 ms
71,304 KB
testcase_04 AC 162 ms
77,212 KB
testcase_05 AC 77 ms
76,656 KB
testcase_06 AC 703 ms
77,640 KB
testcase_07 AC 700 ms
77,464 KB
testcase_08 WA -
testcase_09 AC 66 ms
71,204 KB
testcase_10 AC 63 ms
71,288 KB
testcase_11 AC 62 ms
71,308 KB
testcase_12 AC 65 ms
71,232 KB
testcase_13 AC 63 ms
71,312 KB
testcase_14 AC 64 ms
71,436 KB
testcase_15 AC 66 ms
71,324 KB
testcase_16 AC 64 ms
71,160 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 67 ms
71,040 KB
testcase_21 AC 772 ms
77,440 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 j in range(M):
      if bit[j] == '1':
        c += B[j]//2
      else:
        c += B[j]
    if c == W:
      flg = True
      break
  if flg:
    ans += 1

print(ans)
0