結果

問題 No.1492 01文字列と転倒
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2021-05-01 04:22:50
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 813 bytes
コンパイル時間 1,632 ms
コンパイル使用メモリ 173,256 KB
実行使用メモリ 808,176 KB
最終ジャッジ日時 2023-09-26 12:55:43
合計ジャッジ時間 17,510 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 MLE -
testcase_03 MLE -
testcase_04 MLE -
testcase_05 MLE -
testcase_06 MLE -
testcase_07 MLE -
testcase_08 MLE -
testcase_09 AC 4 ms
4,372 KB
testcase_10 AC 2 ms
4,372 KB
testcase_11 AC 2 ms
4,372 KB
testcase_12 AC 2 ms
4,372 KB
testcase_13 AC 1 ms
4,372 KB
testcase_14 MLE -
testcase_15 AC 4 ms
4,376 KB
testcase_16 AC 25 ms
14,312 KB
testcase_17 MLE -
testcase_18 AC 27 ms
15,948 KB
testcase_19 AC 3 ms
4,376 KB
testcase_20 AC 17 ms
11,160 KB
testcase_21 AC 969 ms
487,984 KB
testcase_22 AC 25 ms
14,304 KB
testcase_23 AC 11 ms
7,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2021.05.01 04:22:45
**/

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

int main() {
    int n,m;cin >> n >> m;
    vector<vector<vector<ll>>> dp(n+1,vector<vector<ll>>(n+1,vector<ll>(n*n+1)));
    dp[0][0][0] = 1;
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= i; j++) {
            if (j <= i+1 && i+1 <= n) for (int k = 0; k+j <= n*n; k++) {
                dp[i+1][j][k+j] += dp[i][j][k];
                dp[i+1][j][k+j] %= m;
            }
            if (i >= j+1) for (int k = 0; k <= n*n; k++) {
                dp[i][j+1][k] += dp[i][j][k];
                dp[i][j+1][k] %= m;
            }
        }
    }
    for (int k = 0; k <= n*n; k++) {
        cout << dp[n][n][k] << endl;
    }
    return 0;
}
0