結果

問題 No.1956 猫の額
ユーザー tnodinotnodino
提出日時 2022-05-24 18:01:14
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
MLE  
実行時間 -
コード長 397 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 202,160 KB
最終ジャッジ日時 2024-09-20 14:28:42
合計ジャッジ時間 43,462 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 MLE * 18 -- * 1
権限があれば一括ダウンロードができます

ソースコード

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