結果

問題 No.1956 猫の額
ユーザー tnodinotnodino
提出日時 2022-05-24 18:02:45
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 397 bytes
コンパイル時間 384 ms
コンパイル使用メモリ 81,856 KB
実行使用メモリ 570,844 KB
最終ジャッジ日時 2023-10-20 18:53:44
合計ジャッジ時間 24,277 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 MLE -
testcase_14 MLE -
testcase_15 MLE -
testcase_16 MLE -
testcase_17 MLE -
testcase_18 MLE -
testcase_19 MLE -
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