結果

問題 No.1238 選抜クラス
ユーザー ああいい
提出日時 2022-05-20 11:06:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 393 bytes
コンパイル時間 232 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 76,928 KB
最終ジャッジ日時 2024-09-19 18:33:30
合計ジャッジ時間 3,559 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K = map(int,input().split())
A = list(map(int,input().split()))
P = 10 ** 9 + 7

C = 10 ** 4 * 2 + 1
base = 10 ** 4
dat = [0] * C
dat[base] = 1
for a in A:
    nx = dat.copy()
    a -= K
    for i in range(C):
        if 0 <= i + a < C:
            nx[i + a] += dat[i]
            nx[i + a] %= P
    dat = nx
ans = 0
for i in range(base,C):
    ans += dat[i]
    ans %= P
print((ans-1) % P)
0