結果

問題 No.1238 選抜クラス
ユーザー irumo8202irumo8202
提出日時 2022-01-28 13:09:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 358 bytes
コンパイル時間 1,057 ms
コンパイル使用メモリ 86,764 KB
実行使用メモリ 77,832 KB
最終ジャッジ日時 2023-08-28 10:02:26
合計ジャッジ時間 6,904 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
71,656 KB
testcase_01 AC 92 ms
71,568 KB
testcase_02 AC 92 ms
71,392 KB
testcase_03 AC 89 ms
71,392 KB
testcase_04 AC 92 ms
71,264 KB
testcase_05 AC 92 ms
71,684 KB
testcase_06 AC 90 ms
71,444 KB
testcase_07 AC 91 ms
71,440 KB
testcase_08 AC 89 ms
71,688 KB
testcase_09 AC 106 ms
77,140 KB
testcase_10 AC 93 ms
71,788 KB
testcase_11 AC 100 ms
77,588 KB
testcase_12 AC 94 ms
71,720 KB
testcase_13 AC 93 ms
71,532 KB
testcase_14 AC 94 ms
71,568 KB
testcase_15 AC 99 ms
77,364 KB
testcase_16 AC 101 ms
77,184 KB
testcase_17 AC 113 ms
77,832 KB
testcase_18 AC 112 ms
77,612 KB
testcase_19 AC 118 ms
77,644 KB
testcase_20 AC 115 ms
77,520 KB
testcase_21 AC 114 ms
77,540 KB
testcase_22 AC 93 ms
71,404 KB
testcase_23 AC 98 ms
76,972 KB
testcase_24 AC 99 ms
77,136 KB
testcase_25 AC 91 ms
71,532 KB
testcase_26 AC 113 ms
77,496 KB
testcase_27 AC 122 ms
77,292 KB
testcase_28 AC 111 ms
77,688 KB
testcase_29 AC 109 ms
77,764 KB
testcase_30 AC 104 ms
77,428 KB
testcase_31 AC 109 ms
77,684 KB
testcase_32 AC 112 ms
77,516 KB
testcase_33 AC 92 ms
71,716 KB
testcase_34 AC 109 ms
77,532 KB
testcase_35 AC 102 ms
77,548 KB
testcase_36 AC 105 ms
77,384 KB
testcase_37 AC 109 ms
77,620 KB
testcase_38 AC 109 ms
77,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

MOD = 10 ** 9 + 7
N, K = map(int, input().split())
A = list(map(lambda x: int(x) - K, input().split()))

dp = defaultdict(int)
dp[0] = 1

for a in A:
    for key, cnt in dp.copy().items():
        dp[key + a] += cnt
        dp[key + a] %= MOD

ans = sum(cnt for key, cnt in dp.items() if key >= 0)
print((ans % MOD) - 1)
0