結果
問題 | No.1956 猫の額 |
ユーザー | tnodino |
提出日時 | 2022-05-24 17:53:17 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 451 bytes |
コンパイル時間 | 210 ms |
コンパイル使用メモリ | 11,888 KB |
実行使用メモリ | 165,560 KB |
最終ジャッジ日時 | 2023-10-20 18:52:13 |
合計ジャッジ時間 | 32,308 ms |
ジャッジサーバーID (参考情報) |
judge11 / 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 | 44 ms
11,936 KB |
testcase_14 | AC | 40 ms
11,232 KB |
testcase_15 | MLE | - |
testcase_16 | MLE | - |
testcase_17 | MLE | - |
testcase_18 | MLE | - |
testcase_19 | MLE | - |
testcase_20 | -- | - |
ソースコード
from collections import defaultdict N,M,C = map(int,input().split()) A = list(map(int,input().split())) S = sum(A) DP = [defaultdict(int) for _ in range(C+1)] DP[0][0] = 1 for i in range(N): DP2 = [defaultdict(int) for _ in range(C+1)] for j in range(C+1): for k,v in DP[j].items(): if j < C: DP2[j+1][k+A[i]] += v % M DP2[j][k] += v % M DP = DP2 print(*[DP[C][i] % M for i in range(1,S+1)])