結果
問題 |
No.1956 猫の額
|
ユーザー |
![]() |
提出日時 | 2025-04-15 21:12:49 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 603 bytes |
コンパイル時間 | 4,175 ms |
コンパイル使用メモリ | 198,328 KB |
実行使用メモリ | 24,704 KB |
最終ジャッジ日時 | 2025-04-15 21:19:02 |
合計ジャッジ時間 | 19,517 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 MLE * 11 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int N, M, C; cin >> N >> M >> C; vector<int> A(N); for (int &a : A) cin >> a; int S = accumulate(A.begin(), A.end(), 0); vector<vector<int>> dp(C + 1, vector<int>(S + 1, 0)); dp[0][0] = 1; for (int a : A) { for (int j = C; j >= 1; --j) { for (int s = S; s >= a; --s) { dp[j][s] = (dp[j][s] + dp[j - 1][s - a]) % M; } } } for (int s = 1; s <= S; ++s) { cout << dp[C][s] % M << (s < S ? ' ' : '\n'); } return 0; }