結果

問題 No.1238 選抜クラス
ユーザー qibqib
提出日時 2022-10-16 20:50:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 153 ms / 2,000 ms
コード長 415 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 78,524 KB
最終ジャッジ日時 2023-09-09 22:16:56
合計ジャッジ時間 7,474 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,240 KB
testcase_01 AC 94 ms
71,320 KB
testcase_02 AC 93 ms
71,320 KB
testcase_03 AC 92 ms
71,476 KB
testcase_04 AC 93 ms
71,508 KB
testcase_05 AC 93 ms
71,148 KB
testcase_06 AC 91 ms
70,968 KB
testcase_07 AC 92 ms
71,148 KB
testcase_08 AC 92 ms
71,264 KB
testcase_09 AC 110 ms
77,604 KB
testcase_10 AC 91 ms
71,496 KB
testcase_11 AC 100 ms
77,348 KB
testcase_12 AC 92 ms
71,392 KB
testcase_13 AC 92 ms
71,584 KB
testcase_14 AC 90 ms
71,328 KB
testcase_15 AC 102 ms
77,324 KB
testcase_16 AC 103 ms
77,424 KB
testcase_17 AC 134 ms
77,908 KB
testcase_18 AC 131 ms
77,852 KB
testcase_19 AC 146 ms
78,336 KB
testcase_20 AC 136 ms
78,040 KB
testcase_21 AC 133 ms
77,996 KB
testcase_22 AC 91 ms
71,236 KB
testcase_23 AC 100 ms
77,364 KB
testcase_24 AC 101 ms
76,924 KB
testcase_25 AC 91 ms
71,380 KB
testcase_26 AC 132 ms
77,840 KB
testcase_27 AC 153 ms
78,524 KB
testcase_28 AC 128 ms
77,636 KB
testcase_29 AC 130 ms
77,800 KB
testcase_30 AC 112 ms
77,360 KB
testcase_31 AC 120 ms
77,548 KB
testcase_32 AC 128 ms
77,784 KB
testcase_33 AC 92 ms
71,360 KB
testcase_34 AC 127 ms
77,652 KB
testcase_35 AC 112 ms
77,472 KB
testcase_36 AC 112 ms
77,376 KB
testcase_37 AC 117 ms
77,596 KB
testcase_38 AC 130 ms
77,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10 ** 9 + 7

from collections import defaultdict

n, k = map(int, input().split())
a = list(map(int, input().split()))

dp = defaultdict(int)
dp[0] = 1
for i in range(n):
  ndp = defaultdict(int)
  for x, v in dp.items():
    ndp[x] = (ndp[x] + v) % MOD
    ndp[x + a[i] - k] = (ndp[x + a[i] - k] + v) % MOD

  dp = ndp

ans = 0
for x, v in dp.items():
	if x >= 0:
		ans = (ans + v) % MOD

ans -= 1
print(ans)
0