結果

問題 No.1238 選抜クラス
ユーザー ayaoniayaoni
提出日時 2020-10-17 09:25:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,964 ms / 2,000 ms
コード長 655 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 87,260 KB
実行使用メモリ 360,680 KB
最終ジャッジ日時 2023-09-28 07:23:43
合計ジャッジ時間 34,441 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
91,352 KB
testcase_01 AC 143 ms
94,840 KB
testcase_02 AC 237 ms
113,896 KB
testcase_03 AC 119 ms
85,132 KB
testcase_04 AC 113 ms
86,204 KB
testcase_05 AC 110 ms
86,068 KB
testcase_06 AC 110 ms
84,988 KB
testcase_07 AC 188 ms
113,888 KB
testcase_08 AC 262 ms
113,672 KB
testcase_09 AC 323 ms
135,324 KB
testcase_10 AC 223 ms
113,476 KB
testcase_11 AC 316 ms
121,600 KB
testcase_12 AC 243 ms
113,992 KB
testcase_13 AC 243 ms
113,640 KB
testcase_14 AC 223 ms
113,736 KB
testcase_15 AC 299 ms
129,496 KB
testcase_16 AC 282 ms
122,140 KB
testcase_17 AC 1,964 ms
360,540 KB
testcase_18 AC 1,769 ms
360,632 KB
testcase_19 AC 1,566 ms
360,504 KB
testcase_20 AC 1,439 ms
343,364 KB
testcase_21 AC 1,421 ms
343,292 KB
testcase_22 AC 1,549 ms
360,508 KB
testcase_23 AC 1,706 ms
360,060 KB
testcase_24 AC 1,656 ms
360,592 KB
testcase_25 AC 1,543 ms
360,548 KB
testcase_26 AC 1,589 ms
360,512 KB
testcase_27 AC 1,575 ms
360,400 KB
testcase_28 AC 1,577 ms
360,664 KB
testcase_29 AC 1,565 ms
360,680 KB
testcase_30 AC 496 ms
158,396 KB
testcase_31 AC 866 ms
252,640 KB
testcase_32 AC 1,270 ms
283,116 KB
testcase_33 AC 190 ms
113,788 KB
testcase_34 AC 1,296 ms
290,508 KB
testcase_35 AC 631 ms
182,600 KB
testcase_36 AC 339 ms
135,980 KB
testcase_37 AC 508 ms
157,876 KB
testcase_38 AC 1,446 ms
342,816 KB
権限があれば一括ダウンロードができます

ソースコード

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