結果

問題 No.1238 選抜クラス
ユーザー tamatotamato
提出日時 2020-09-25 21:39:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 614 bytes
コンパイル時間 354 ms
コンパイル使用メモリ 87,580 KB
実行使用メモリ 92,172 KB
最終ジャッジ日時 2023-09-10 15:03:48
合計ジャッジ時間 5,885 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
76,932 KB
testcase_01 AC 78 ms
77,004 KB
testcase_02 AC 82 ms
77,728 KB
testcase_03 AC 80 ms
76,532 KB
testcase_04 AC 80 ms
76,476 KB
testcase_05 AC 80 ms
76,720 KB
testcase_06 AC 79 ms
76,528 KB
testcase_07 AC 82 ms
77,384 KB
testcase_08 AC 85 ms
77,892 KB
testcase_09 AC 92 ms
78,412 KB
testcase_10 AC 84 ms
77,528 KB
testcase_11 AC 89 ms
78,540 KB
testcase_12 AC 87 ms
78,052 KB
testcase_13 AC 87 ms
77,932 KB
testcase_14 AC 85 ms
77,800 KB
testcase_15 AC 87 ms
78,668 KB
testcase_16 AC 86 ms
78,492 KB
testcase_17 AC 132 ms
92,156 KB
testcase_18 AC 135 ms
91,572 KB
testcase_19 AC 131 ms
91,788 KB
testcase_20 AC 130 ms
91,368 KB
testcase_21 AC 132 ms
90,856 KB
testcase_22 AC 133 ms
92,120 KB
testcase_23 AC 133 ms
92,156 KB
testcase_24 AC 135 ms
92,136 KB
testcase_25 AC 128 ms
91,860 KB
testcase_26 AC 134 ms
91,824 KB
testcase_27 AC 133 ms
92,104 KB
testcase_28 AC 135 ms
92,172 KB
testcase_29 AC 135 ms
91,956 KB
testcase_30 AC 98 ms
81,096 KB
testcase_31 AC 113 ms
85,000 KB
testcase_32 AC 120 ms
88,544 KB
testcase_33 AC 84 ms
77,112 KB
testcase_34 AC 131 ms
89,684 KB
testcase_35 AC 107 ms
82,428 KB
testcase_36 AC 94 ms
79,164 KB
testcase_37 AC 102 ms
81,256 KB
testcase_38 AC 134 ms
91,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    B = [a - K for a in A]
    dp = [[0] * (20010) for _ in range(N+1)]
    dp[0][0] = 1
    for i, b in enumerate(B):
        for j in range(-10000, 10001):
            dp[i+1][j] = (dp[i+1][j] + dp[i][j])%mod
            if -10000 <= j+b <= 10000:
                dp[i+1][j+b] = (dp[i+1][j+b] + dp[i][j])%mod
    ans = 0
    for j in range(10001):
        ans = (ans + dp[-1][j])%mod
    print(ans - 1)


if __name__ == '__main__':
    main()
0