結果

問題 No.1238 選抜クラス
ユーザー NagisaNagisa
提出日時 2020-09-25 22:44:22
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
TLE  
実行時間 -
コード長 519 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 10,832 KB
実行使用メモリ 12,248 KB
最終ジャッジ日時 2023-09-10 15:56:50
合計ジャッジ時間 5,083 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
12,248 KB
testcase_01 AC 16 ms
7,988 KB
testcase_02 AC 33 ms
8,448 KB
testcase_03 AC 15 ms
7,864 KB
testcase_04 AC 15 ms
7,884 KB
testcase_05 AC 15 ms
7,888 KB
testcase_06 AC 16 ms
7,864 KB
testcase_07 AC 23 ms
8,340 KB
testcase_08 AC 42 ms
8,728 KB
testcase_09 AC 126 ms
9,676 KB
testcase_10 AC 31 ms
8,400 KB
testcase_11 AC 86 ms
9,228 KB
testcase_12 AC 45 ms
8,592 KB
testcase_13 AC 57 ms
8,652 KB
testcase_14 AC 32 ms
8,360 KB
testcase_15 AC 125 ms
9,632 KB
testcase_16 AC 113 ms
9,512 KB
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
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