結果

問題 No.1956 猫の額
ユーザー tnodinotnodino
提出日時 2022-05-24 18:01:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
MLE  
実行時間 -
コード長 397 bytes
コンパイル時間 248 ms
コンパイル使用メモリ 11,916 KB
実行使用メモリ 42,664 KB
最終ジャッジ日時 2023-10-20 18:53:16
合計ジャッジ時間 47,338 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 MLE -
testcase_02 MLE -
testcase_03 MLE -
testcase_04 MLE -
testcase_05 MLE -
testcase_06 MLE -
testcase_07 MLE -
testcase_08 MLE -
testcase_09 MLE -
testcase_10 MLE -
testcase_11 MLE -
testcase_12 MLE -
testcase_13 AC 48 ms
13,120 KB
testcase_14 AC 42 ms
11,788 KB
testcase_15 MLE -
testcase_16 MLE -
testcase_17 MLE -
testcase_18 MLE -
testcase_19 TLE -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
N,M,C = map(int,input().split())
A = list(map(int,input().split()))
S = sum(A)
DP = defaultdict(int)
DP[0, 0] = 1
for i in range(N):
    DP2 = defaultdict(int)
    for k,v in DP.items():
        c = k[0]
        x = k[1]
        if c < C:
            DP2[c+1, x+A[i]] += v % M
        DP2[c, x] += v % M
    DP = DP2
print(*[DP[C, i] % M for i in range(1,S+1)])
0