結果

問題 No.1956 猫の額
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2022-05-25 01:05:55
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 732 bytes
コンパイル時間 1,679 ms
コンパイル使用メモリ 172,076 KB
実行使用メモリ 24,976 KB
最終ジャッジ日時 2023-10-20 19:03:41
合計ジャッジ時間 18,601 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 AC 21 ms
5,704 KB
testcase_02 MLE -
testcase_03 AC 33 ms
6,496 KB
testcase_04 AC 660 ms
13,888 KB
testcase_05 AC 572 ms
13,096 KB
testcase_06 AC 576 ms
12,304 KB
testcase_07 MLE -
testcase_08 MLE -
testcase_09 AC 84 ms
8,080 KB
testcase_10 MLE -
testcase_11 AC 384 ms
10,460 KB
testcase_12 MLE -
testcase_13 AC 4 ms
4,348 KB
testcase_14 AC 82 ms
4,648 KB
testcase_15 AC 25 ms
5,968 KB
testcase_16 MLE -
testcase_17 MLE -
testcase_18 MLE -
testcase_19 MLE -
testcase_20 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2022.05.25 01:05:29
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;


int main() {
    int n,m,c;cin >> n >> m >> c;
    int sum = 0;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    vector<vector<int>> dp(c+1,vector<int>(sum+1));
    dp[0][0] = 1;
    for (int i = 0; i < n; i++) {
        for (int j = c; j >= 1; j--) {
            for (int s = a[i]; s <= sum; s++) {
                dp[j][s] += dp[j-1][s-a[i]];
                dp[j][s] %= m;
            }
        }
    }
    for (int i = 1; i <= sum; i++) {
        cout << dp[c][i] << " ";
    }
    cout << endl;
    return 0;
}
0