結果

問題 No.1238 選抜クラス
ユーザー ayaoniayaoni
提出日時 2020-10-17 09:27:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 670 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 10,824 KB
実行使用メモリ 289,252 KB
最終ジャッジ日時 2023-09-28 07:24:45
合計ジャッジ時間 9,167 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
16,508 KB
testcase_01 AC 92 ms
17,912 KB
testcase_02 AC 244 ms
39,504 KB
testcase_03 AC 45 ms
12,924 KB
testcase_04 AC 44 ms
13,060 KB
testcase_05 AC 44 ms
13,520 KB
testcase_06 AC 44 ms
12,888 KB
testcase_07 AC 168 ms
26,204 KB
testcase_08 AC 249 ms
39,496 KB
testcase_09 AC 370 ms
46,200 KB
testcase_10 AC 192 ms
28,048 KB
testcase_11 AC 340 ms
44,424 KB
testcase_12 AC 271 ms
40,264 KB
testcase_13 AC 276 ms
39,600 KB
testcase_14 AC 262 ms
40,260 KB
testcase_15 AC 375 ms
46,140 KB
testcase_16 AC 349 ms
44,960 KB
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 TLE -
testcase_30 AC 790 ms
87,352 KB
testcase_31 AC 1,514 ms
155,368 KB
testcase_32 TLE -
testcase_33 AC 181 ms
26,660 KB
testcase_34 TLE -
testcase_35 AC 1,052 ms
135,936 KB
testcase_36 AC 490 ms
71,372 KB
testcase_37 AC 878 ms
90,976 KB
testcase_38 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import defaultdict
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり


N,K = MI()
A = LI()
for i in range(N):
    A[i] -= K
mod = 10**9+7
A = [0]+A

# 和が0以上になる選び方を数え上げる

dp = defaultdict(int)  # dp[(i,j)] = 生徒1~iの中から選ぶ時、和がjになるような選び方
dp[(0,0)] = 1
for i in range(1,N+1):
    a = A[i]
    for j in range(-10000,10001):
        dp[(i,j)] = dp[(i-1,j)]+dp[(i-1,j-a)]
        dp[(i,j)] %= mod

ans = -1
for i in range(10001):
    ans += dp[(N,i)]
    ans %= mod

print(ans)
0