結果

問題 No.1238 選抜クラス
ユーザー wolgnikwolgnik
提出日時 2020-09-25 21:48:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 759 bytes
コンパイル時間 320 ms
コンパイル使用メモリ 87,052 KB
実行使用メモリ 76,296 KB
最終ジャッジ日時 2023-09-10 15:11:04
合計ジャッジ時間 4,986 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,344 KB
testcase_01 AC 73 ms
71,316 KB
testcase_02 AC 78 ms
75,860 KB
testcase_03 AC 73 ms
71,476 KB
testcase_04 AC 71 ms
71,440 KB
testcase_05 AC 70 ms
71,444 KB
testcase_06 AC 71 ms
71,308 KB
testcase_07 AC 76 ms
75,724 KB
testcase_08 AC 76 ms
75,724 KB
testcase_09 AC 81 ms
76,260 KB
testcase_10 AC 76 ms
75,756 KB
testcase_11 AC 81 ms
76,280 KB
testcase_12 AC 78 ms
75,652 KB
testcase_13 AC 77 ms
75,952 KB
testcase_14 AC 77 ms
75,508 KB
testcase_15 AC 79 ms
76,164 KB
testcase_16 AC 78 ms
76,212 KB
testcase_17 AC 85 ms
76,296 KB
testcase_18 AC 87 ms
76,176 KB
testcase_19 AC 85 ms
76,144 KB
testcase_20 WA -
testcase_21 AC 85 ms
76,264 KB
testcase_22 AC 77 ms
75,992 KB
testcase_23 AC 82 ms
76,264 KB
testcase_24 AC 80 ms
76,204 KB
testcase_25 AC 76 ms
76,056 KB
testcase_26 WA -
testcase_27 AC 86 ms
76,020 KB
testcase_28 AC 87 ms
76,040 KB
testcase_29 WA -
testcase_30 AC 83 ms
76,204 KB
testcase_31 AC 83 ms
76,240 KB
testcase_32 AC 84 ms
76,232 KB
testcase_33 AC 75 ms
75,632 KB
testcase_34 WA -
testcase_35 AC 81 ms
76,216 KB
testcase_36 AC 80 ms
76,004 KB
testcase_37 AC 83 ms
76,184 KB
testcase_38 AC 88 ms
76,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N, K = map(int, input().split())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
a.sort()
for i in range(N): a[i] -= K
mn = []
zr = 0
pl = []
for x in a:
  if x < 0: mn.append(-x)
  elif x == 0: zr += 1
  else: pl.append(x)

ln = N * 100
dpmn = [0] * (ln + 1)
dpmn[0] = 1
dppl = [0] * (ln + 1)
dppl[0] = 1
for x in mn:
  for i in range(ln, -1, -1):
    if dpmn[i]:
      dpmn[i + x] += dpmn[i]
      dpmn[i + x] %= mod
for x in pl:
  for i in range(ln, -1, -1):
    if dppl[i]:
      dppl[i + x] += dppl[i]
      dppl[i + x] %= mod
for i in range(ln, 0, -1):
  dppl[i - 1] += dppl[i]
  dppl[i - 1] %= mod
res = 0
for i in range(ln + 1):
  res += dppl[i] * dpmn[i]
  res %= mod
print(res * pow(2, zr, mod) - 1 % mod)
0