結果

問題 No.1238 選抜クラス
ユーザー NagisaNagisa
提出日時 2020-09-25 22:44:58
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 519 bytes
コンパイル時間 850 ms
コンパイル使用メモリ 87,172 KB
実行使用メモリ 841,036 KB
最終ジャッジ日時 2023-09-10 15:58:05
合計ジャッジ時間 12,473 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,232 KB
testcase_01 AC 72 ms
71,232 KB
testcase_02 AC 89 ms
76,192 KB
testcase_03 AC 74 ms
71,548 KB
testcase_04 AC 73 ms
71,400 KB
testcase_05 AC 74 ms
71,340 KB
testcase_06 AC 73 ms
71,308 KB
testcase_07 AC 86 ms
76,020 KB
testcase_08 AC 88 ms
75,992 KB
testcase_09 AC 91 ms
76,104 KB
testcase_10 AC 88 ms
76,036 KB
testcase_11 AC 91 ms
76,084 KB
testcase_12 AC 88 ms
76,352 KB
testcase_13 AC 90 ms
76,068 KB
testcase_14 AC 87 ms
76,248 KB
testcase_15 AC 93 ms
76,256 KB
testcase_16 AC 90 ms
76,212 KB
testcase_17 TLE -
testcase_18 TLE -
testcase_19 MLE -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

dp = [[[0]*(max(sum(A),N*K)+1) for k in range(N+1)] for l in range(N+1)]
# dp[i][j][k] := i番目まででj人選んで合計点がkになる組み合わせの数
dp[0][0][0] = 1

for i in range(N):
    for j in range(N):
        for k in range(sum(A)+1):
            dp[i+1][j][k] += dp[i][j][k]
            if k-A[i] >= 0:
                dp[i+1][j+1][k] += dp[i][j][k-A[i]]

ans = 0
for k in range(1,N+1):
    ans += sum(dp[N][k][K*k:])
print(ans)
0