結果

問題 No.1492 01文字列と転倒
ユーザー SSRSSSRS
提出日時 2021-04-30 21:25:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 690 bytes
コンパイル時間 1,617 ms
コンパイル使用メモリ 170,784 KB
実行使用メモリ 808,376 KB
最終ジャッジ日時 2023-09-26 04:23:57
合計ジャッジ時間 10,972 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 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 3 ms
4,368 KB
testcase_10 AC 1 ms
4,368 KB
testcase_11 AC 2 ms
4,368 KB
testcase_12 AC 1 ms
4,372 KB
testcase_13 AC 1 ms
4,368 KB
testcase_14 MLE -
testcase_15 AC 3 ms
4,372 KB
testcase_16 AC 16 ms
14,548 KB
testcase_17 MLE -
testcase_18 AC 16 ms
16,216 KB
testcase_19 AC 2 ms
4,372 KB
testcase_20 AC 11 ms
11,292 KB
testcase_21 AC 561 ms
487,952 KB
testcase_22 AC 15 ms
14,352 KB
testcase_23 AC 7 ms
7,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, M;
  cin >> N >> M;
  vector<vector<vector<long long>>> dp(N + 1, vector<vector<long long>>(N + 1, vector<long long>(N * N + 1, 0)));
  dp[0][0][0] = 1;
  for (int i = 0; i <= N; i++){
    for (int j = 0; j <= N; j++){
      for (int k = 0; k <= N * N; k++){
        if (dp[i][j][k] > 0){
          if (i < N){
            dp[i + 1][j][k + j] += dp[i][j][k];
            dp[i + 1][j][k + j] %= M;
          }
          if (j < i){
            dp[i][j + 1][k] += dp[i][j][k];
            dp[i][j + 1][k] %= M;
          }
        }
      }
    }
  }
  for (int i = 0; i <= N * N; i++){
    cout << dp[N][N][i] << endl;
  }
}
0