結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,636 KB
testcase_01 AC 91 ms
71,716 KB
testcase_02 AC 93 ms
71,668 KB
testcase_03 AC 92 ms
71,404 KB
testcase_04 AC 92 ms
71,448 KB
testcase_05 AC 92 ms
71,796 KB
testcase_06 AC 95 ms
71,452 KB
testcase_07 AC 92 ms
71,280 KB
testcase_08 AC 92 ms
71,596 KB
testcase_09 AC 98 ms
76,988 KB
testcase_10 AC 94 ms
71,452 KB
testcase_11 AC 99 ms
77,284 KB
testcase_12 AC 94 ms
71,544 KB
testcase_13 AC 94 ms
71,672 KB
testcase_14 AC 92 ms
71,528 KB
testcase_15 AC 100 ms
77,116 KB
testcase_16 AC 100 ms
77,396 KB
testcase_17 AC 114 ms
77,508 KB
testcase_18 AC 117 ms
77,852 KB
testcase_19 AC 121 ms
77,656 KB
testcase_20 AC 117 ms
77,596 KB
testcase_21 AC 116 ms
77,504 KB
testcase_22 AC 95 ms
71,640 KB
testcase_23 AC 100 ms
77,300 KB
testcase_24 AC 100 ms
77,092 KB
testcase_25 AC 92 ms
71,388 KB
testcase_26 AC 116 ms
77,548 KB
testcase_27 AC 121 ms
77,580 KB
testcase_28 AC 112 ms
77,488 KB
testcase_29 AC 112 ms
77,296 KB
testcase_30 AC 101 ms
77,192 KB
testcase_31 AC 109 ms
77,540 KB
testcase_32 AC 108 ms
77,608 KB
testcase_33 AC 93 ms
71,632 KB
testcase_34 AC 111 ms
77,636 KB
testcase_35 AC 105 ms
77,444 KB
testcase_36 AC 104 ms
77,372 KB
testcase_37 AC 107 ms
77,552 KB
testcase_38 AC 107 ms
77,744 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