結果

問題 No.1238 選抜クラス
ユーザー persimmon-persimmonpersimmon-persimmon
提出日時 2021-03-03 10:34:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 548 bytes
コンパイル時間 376 ms
コンパイル使用メモリ 82,524 KB
実行使用メモリ 86,304 KB
最終ジャッジ日時 2024-04-14 05:53:36
合計ジャッジ時間 4,240 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
54,828 KB
testcase_01 AC 45 ms
59,488 KB
testcase_02 AC 50 ms
60,920 KB
testcase_03 AC 41 ms
55,016 KB
testcase_04 AC 42 ms
54,068 KB
testcase_05 AC 41 ms
55,048 KB
testcase_06 AC 44 ms
54,508 KB
testcase_07 AC 46 ms
60,368 KB
testcase_08 AC 50 ms
61,912 KB
testcase_09 AC 51 ms
63,364 KB
testcase_10 AC 46 ms
60,984 KB
testcase_11 AC 52 ms
63,488 KB
testcase_12 AC 50 ms
63,164 KB
testcase_13 AC 48 ms
61,724 KB
testcase_14 AC 48 ms
62,240 KB
testcase_15 AC 56 ms
65,324 KB
testcase_16 AC 50 ms
62,744 KB
testcase_17 AC 92 ms
85,540 KB
testcase_18 AC 92 ms
85,332 KB
testcase_19 AC 88 ms
84,828 KB
testcase_20 AC 85 ms
83,684 KB
testcase_21 AC 88 ms
83,544 KB
testcase_22 AC 77 ms
84,508 KB
testcase_23 AC 80 ms
85,120 KB
testcase_24 AC 78 ms
84,596 KB
testcase_25 AC 76 ms
84,864 KB
testcase_26 AC 86 ms
85,500 KB
testcase_27 AC 90 ms
85,224 KB
testcase_28 AC 93 ms
86,304 KB
testcase_29 AC 91 ms
85,856 KB
testcase_30 AC 57 ms
70,376 KB
testcase_31 AC 69 ms
75,888 KB
testcase_32 AC 72 ms
75,532 KB
testcase_33 AC 47 ms
61,080 KB
testcase_34 AC 86 ms
82,248 KB
testcase_35 AC 61 ms
73,324 KB
testcase_36 AC 50 ms
63,816 KB
testcase_37 AC 56 ms
68,036 KB
testcase_38 AC 88 ms
84,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main0(n,k,a):
  mod=10**9+7
  from collections import defaultdict
  # dp[i][j]:i人選んで合計点がjの場合数。
  aa=[x-k for x in a]
  dp=[0]*(200*n+1)
  dp[0]=1
  for i in range(n):
    ndp=dp[:]
    for j in reversed(range(-100*n,100*n+1)):
      if dp[j]==0:continue
      ndp[j+aa[i]]+=dp[j]
      ndp[j+aa[i]]%=mod
    dp=ndp
  ans=-1
  for i in range(100*n+1):
    ans+=dp[i]
    ans%=mod
  return ans
if __name__=='__main__':
  n,k=map(int,input().split())
  a=list(map(int,input().split()))

  ret0=main0(n,k,a)
  print(ret0)
0