結果

問題 No.1238 選抜クラス
ユーザー H3PO4H3PO4
提出日時 2020-09-25 21:56:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 306 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 10,584 KB
実行使用メモリ 30,008 KB
最終ジャッジ日時 2023-09-10 15:23:58
合計ジャッジ時間 9,239 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
29,876 KB
testcase_01 AC 137 ms
29,848 KB
testcase_02 AC 134 ms
29,912 KB
testcase_03 RE -
testcase_04 AC 133 ms
29,832 KB
testcase_05 AC 130 ms
29,760 KB
testcase_06 RE -
testcase_07 AC 131 ms
29,984 KB
testcase_08 AC 132 ms
29,900 KB
testcase_09 AC 133 ms
29,932 KB
testcase_10 AC 131 ms
29,948 KB
testcase_11 AC 140 ms
29,944 KB
testcase_12 AC 141 ms
29,940 KB
testcase_13 AC 141 ms
29,844 KB
testcase_14 AC 141 ms
29,896 KB
testcase_15 AC 136 ms
29,908 KB
testcase_16 AC 134 ms
29,896 KB
testcase_17 AC 162 ms
29,936 KB
testcase_18 AC 159 ms
29,836 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 159 ms
29,804 KB
testcase_24 AC 160 ms
29,888 KB
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 142 ms
29,860 KB
testcase_31 AC 149 ms
29,868 KB
testcase_32 AC 154 ms
29,904 KB
testcase_33 AC 133 ms
29,760 KB
testcase_34 RE -
testcase_35 AC 146 ms
29,936 KB
testcase_36 AC 139 ms
29,956 KB
testcase_37 AC 142 ms
29,916 KB
testcase_38 RE -
権限があれば一括ダウンロードができます

ソースコード

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[:-a]
    else:
        dp[:a] += dp[-a:]
    dp %= MOD
print((dp[L:].sum() - 1) % MOD)
0