結果

問題 No.1238 選抜クラス
ユーザー roarisroaris
提出日時 2020-11-18 16:18:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 166 ms / 2,000 ms
コード長 428 bytes
コンパイル時間 1,804 ms
コンパイル使用メモリ 86,876 KB
実行使用メモリ 78,724 KB
最終ジャッジ日時 2023-09-30 15:04:40
合計ジャッジ時間 6,246 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,676 KB
testcase_01 AC 95 ms
71,756 KB
testcase_02 AC 95 ms
71,740 KB
testcase_03 AC 102 ms
71,636 KB
testcase_04 AC 94 ms
71,756 KB
testcase_05 AC 97 ms
71,884 KB
testcase_06 AC 99 ms
71,608 KB
testcase_07 AC 97 ms
71,816 KB
testcase_08 AC 98 ms
71,592 KB
testcase_09 AC 109 ms
77,784 KB
testcase_10 AC 95 ms
71,892 KB
testcase_11 AC 104 ms
77,616 KB
testcase_12 AC 97 ms
71,756 KB
testcase_13 AC 99 ms
71,636 KB
testcase_14 AC 95 ms
71,908 KB
testcase_15 AC 109 ms
77,776 KB
testcase_16 AC 107 ms
77,724 KB
testcase_17 AC 141 ms
78,028 KB
testcase_18 AC 143 ms
78,464 KB
testcase_19 AC 157 ms
78,532 KB
testcase_20 AC 146 ms
78,332 KB
testcase_21 AC 149 ms
78,008 KB
testcase_22 AC 98 ms
71,488 KB
testcase_23 AC 106 ms
77,504 KB
testcase_24 AC 108 ms
77,620 KB
testcase_25 AC 97 ms
71,724 KB
testcase_26 AC 144 ms
78,288 KB
testcase_27 AC 166 ms
78,724 KB
testcase_28 AC 136 ms
78,192 KB
testcase_29 AC 135 ms
78,104 KB
testcase_30 AC 116 ms
77,552 KB
testcase_31 AC 125 ms
77,836 KB
testcase_32 AC 139 ms
78,496 KB
testcase_33 AC 93 ms
71,912 KB
testcase_34 AC 132 ms
77,944 KB
testcase_35 AC 121 ms
77,836 KB
testcase_36 AC 117 ms
77,788 KB
testcase_37 AC 119 ms
77,768 KB
testcase_38 AC 136 ms
78,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *

N, K = map(int, input().split())
A = list(map(int, input().split()))
A = list(map(lambda x: x-K, A))
dp = defaultdict(int)
dp[0] = 1
MOD = 10**9+7

for i in range(N):
    ndp = defaultdict(int)
    
    for k in dp:
        ndp[k] = (ndp[k]+dp[k])%MOD
        ndp[k+A[i]] = (ndp[k+A[i]]+dp[k])%MOD

    dp = ndp
    
ans = 0

for k in dp:
    if k>=0:
        ans = (ans+dp[k])%MOD

print((ans-1)%MOD)
0