結果

問題 No.1701 half price
ユーザー ysys
提出日時 2022-03-07 02:04:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 418 bytes
コンパイル時間 326 ms
コンパイル使用メモリ 86,856 KB
実行使用メモリ 77,248 KB
最終ジャッジ日時 2023-09-28 19:03:38
合計ジャッジ時間 4,723 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,376 KB
testcase_01 AC 76 ms
71,204 KB
testcase_02 AC 116 ms
77,080 KB
testcase_03 AC 78 ms
71,316 KB
testcase_04 AC 116 ms
77,248 KB
testcase_05 AC 86 ms
76,496 KB
testcase_06 AC 345 ms
77,248 KB
testcase_07 AC 352 ms
76,832 KB
testcase_08 WA -
testcase_09 AC 76 ms
71,400 KB
testcase_10 AC 77 ms
71,124 KB
testcase_11 AC 75 ms
71,296 KB
testcase_12 AC 77 ms
71,224 KB
testcase_13 AC 76 ms
71,300 KB
testcase_14 AC 75 ms
71,400 KB
testcase_15 AC 76 ms
71,296 KB
testcase_16 AC 77 ms
71,280 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 77 ms
71,480 KB
testcase_21 AC 338 ms
77,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, W = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(1 << N):
  C = []
  res = 0
  add = 0
  for j in range(N):
    if i & 1 << j:
      res += a[j]
      C.append(j)
  if res == W:
    add = 1

  L = len(C)
  for j in range(1 << L):
    res2 = res
    for k in range(L):
      if j & 1 << k:
        res2 -= a[C[k]] // 2

    if res2 == W:
      add = 1

  ans += add
print(ans)
0