結果

問題 No.1238 選抜クラス
ユーザー H3PO4H3PO4
提出日時 2020-09-25 22:18:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 164 ms / 2,000 ms
コード長 316 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 10,660 KB
実行使用メモリ 30,040 KB
最終ジャッジ日時 2023-09-10 15:33:22
合計ジャッジ時間 8,063 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
29,896 KB
testcase_01 AC 138 ms
30,040 KB
testcase_02 AC 137 ms
29,948 KB
testcase_03 AC 136 ms
29,772 KB
testcase_04 AC 136 ms
29,940 KB
testcase_05 AC 137 ms
29,820 KB
testcase_06 AC 135 ms
29,740 KB
testcase_07 AC 135 ms
29,860 KB
testcase_08 AC 139 ms
30,008 KB
testcase_09 AC 140 ms
29,928 KB
testcase_10 AC 136 ms
29,956 KB
testcase_11 AC 140 ms
29,924 KB
testcase_12 AC 137 ms
29,908 KB
testcase_13 AC 138 ms
29,916 KB
testcase_14 AC 135 ms
29,960 KB
testcase_15 AC 139 ms
29,864 KB
testcase_16 AC 137 ms
29,924 KB
testcase_17 AC 164 ms
29,920 KB
testcase_18 AC 162 ms
29,968 KB
testcase_19 AC 161 ms
29,888 KB
testcase_20 AC 161 ms
29,980 KB
testcase_21 AC 160 ms
29,976 KB
testcase_22 AC 163 ms
29,800 KB
testcase_23 AC 160 ms
29,856 KB
testcase_24 AC 162 ms
29,904 KB
testcase_25 AC 161 ms
29,812 KB
testcase_26 AC 163 ms
29,908 KB
testcase_27 AC 161 ms
29,632 KB
testcase_28 AC 161 ms
29,872 KB
testcase_29 AC 161 ms
30,012 KB
testcase_30 AC 141 ms
29,972 KB
testcase_31 AC 148 ms
29,976 KB
testcase_32 AC 155 ms
29,884 KB
testcase_33 AC 135 ms
29,728 KB
testcase_34 AC 157 ms
29,980 KB
testcase_35 AC 145 ms
30,016 KB
testcase_36 AC 141 ms
29,900 KB
testcase_37 AC 144 ms
29,952 KB
testcase_38 AC 162 ms
29,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

N, K = map(int, input().split())
A = [int(x) - K for x in input().split()]

MOD = 10 ** 9 + 7
L = 10000
dp = np.zeros(2 * L + 1, dtype=int)
dp[L] = 1

for a in A:
    if a >= 0:
        dp[a:] += dp[:2 * L + 1 - a]
    else:
        dp[:a] += dp[-a:]
    dp %= MOD
print((sum(dp[L:]) - 1) % MOD)
0